Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ import PackageDescription

let package = Package(
name: "Wrap",
platforms: [
.iOS(.v13),
.macOS(.v10_15),
.tvOS(.v13),
.watchOS(.v6)
],
products: [
.library(name: "Wrap", targets: ["Wrap"]),
],
Expand Down
12 changes: 6 additions & 6 deletions Sources/Wrap/Wrap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,35 @@ public struct _FlowDownBox<Value>: ~Copyable {

}

public func modify<Value>(_ value: inout Value, _ modifier: (inout Value) throws -> Void) rethrows {
public func modify<Value>(_ value: inout Value, _ modifier: (inout Value) throws -> Void, isolation: isolated (any Actor)? = #isolation) rethrows {
try modifier(&value)
}

extension _FlowDownBox {

public consuming func map<U>(_ transform: (consuming Value) throws -> U) rethrows -> U {
public consuming func map<U>(_ transform: (consuming Value) throws -> U, isolation: isolated (any Actor)? = #isolation) rethrows -> U {
try transform(value)
}

@discardableResult
public consuming func `do`(_ applier: (consuming Value) throws -> Void) rethrows -> Value {
public consuming func `do`(_ applier: (consuming Value) throws -> Void, isolation: isolated (any Actor)? = #isolation) rethrows -> Value {
try applier(value)
return value
}

@discardableResult
@_disfavoredOverload
public consuming func `do`(_ applier: (consuming Value) throws -> Void) rethrows -> Value? {
public consuming func `do`(_ applier: (consuming Value) throws -> Void, isolation: isolated (any Actor)? = #isolation) rethrows -> Value? {
try applier(value)
return value
}

public consuming func modify(_ modifier: (inout Value) throws -> Void) rethrows -> Value {
public consuming func modify(_ modifier: (inout Value) throws -> Void, isolation: isolated (any Actor)? = #isolation) rethrows -> Value {
try modifier(&value)
return value
}

public consuming func filter(_ filter: (consuming Value) -> Bool) -> Value? {
public consuming func filter(_ filter: (consuming Value) -> Bool, isolation: isolated (any Actor)? = #isolation) -> Value? {
guard filter(value) else {
return nil
}
Expand Down
Loading