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.
|
||||
public protocol ImmutablePlugin: Plugin where Output == Void, Source == ImmutablePluginable {
|
||||
/// The input value that the plugin will handle.
|
||||
associatedtype Value
|
||||
associatedtype Input = Input
|
||||
|
||||
/// Handles the input value.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - value: The input value that the plugin will handle.
|
||||
/// - 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
|
||||
|
||||
extension ImmutablePlugin where Value == Input {
|
||||
extension ImmutablePlugin {
|
||||
/// A keypath that provides access to the `immutable` property of the `Source`.
|
||||
public var keyPath: WritableKeyPath<Source, ()> {
|
||||
get { \.immutable }
|
||||
set { }
|
||||
}
|
||||
|
||||
public func handle(value: Value, output: inout ()) async throws {
|
||||
public func handle(value: Input, output: inout ()) async throws {
|
||||
try await handle(value: value)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue