Skip to content

Commit

Permalink
Update modify operator (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii authored Aug 22, 2024
1 parent 74cca61 commit 8b6b3b0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Sources/Wrap/Wrap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public func <& <T>(argument: inout T, modifier: (inout T) throws -> Void) rethro

public struct _FlowDownBox<Value>: ~Copyable {

public let value: Value
public var value: Value

public init(_ value: consuming Value) {
self.value = consume value
Expand Down Expand Up @@ -44,9 +44,8 @@ extension _FlowDownBox {
}

public consuming func modify(_ modifier: (inout Value) throws -> Void) rethrows -> Value {
var v = value
try modifier(&v)
return v
try modifier(&value)
return value
}

public consuming func filter(_ filter: (consuming Value) -> Bool) -> Value? {
Expand Down

0 comments on commit 8b6b3b0

Please sign in to comment.