Update ImmutablePlugin associatedtype (#6)
This commit is contained in:
parent
9a84b81ac4
commit
415a13b088
|
@ -1,26 +1,25 @@
|
||||||
/// A protocol that defines a plugin that can be registered and handled by a `Pluginable` object.
|
/// A protocol that defines a plugin that can be registered and handled by a `Pluginable` object.
|
||||||
public protocol ImmutablePlugin: Plugin where Output == Void, Source == ImmutablePluginable {
|
public protocol ImmutablePlugin: Plugin where Output == Void, Source == ImmutablePluginable {
|
||||||
/// The input value that the plugin will handle.
|
associatedtype Input = Input
|
||||||
associatedtype Value
|
|
||||||
|
|
||||||
/// Handles the input value.
|
/// Handles the input value.
|
||||||
///
|
///
|
||||||
/// - Parameters:
|
/// - Parameters:
|
||||||
/// - value: The input value that the plugin will handle.
|
/// - value: The input value that the plugin will handle.
|
||||||
/// - Throws: Any errors that occur during handling of the input value.
|
/// - Throws: Any errors that occur during handling of the input value.
|
||||||
func handle(value: Value) async throws
|
func handle(value: Input) async throws
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Public Implementation
|
// MARK: Public Implementation
|
||||||
|
|
||||||
extension ImmutablePlugin where Value == Input {
|
extension ImmutablePlugin {
|
||||||
/// A keypath that provides access to the `immutable` property of the `Source`.
|
/// A keypath that provides access to the `immutable` property of the `Source`.
|
||||||
public var keyPath: WritableKeyPath<Source, ()> {
|
public var keyPath: WritableKeyPath<Source, ()> {
|
||||||
get { \.immutable }
|
get { \.immutable }
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public func handle(value: Value, output: inout ()) async throws {
|
public func handle(value: Input, output: inout ()) async throws {
|
||||||
try await handle(value: value)
|
try await handle(value: value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue