diff --git a/Sources/Concurrency/TaskFactory/ITaskFactory.swift b/Sources/Concurrency/TaskFactory/ITaskFactory.swift index ad8fc73..bd87057 100644 --- a/Sources/Concurrency/TaskFactory/ITaskFactory.swift +++ b/Sources/Concurrency/TaskFactory/ITaskFactory.swift @@ -19,6 +19,7 @@ import Foundation /// - operation: An asynchronous operation to execute within the task. The operation /// inherits the current actor context and is isolated to that actor. /// - Returns: A `Task` object that wraps the result or error of the operation. + @discardableResult func task( priority: TaskPriority?, @_inheritActorContext operation: sending @escaping @isolated(any) () async throws -> Success @@ -30,6 +31,7 @@ import Foundation /// - operation: An asynchronous operation to execute within the task. The operation /// inherits the current actor context and is isolated to that actor. /// - Returns: A `Task` object that wraps the result of the operation. + @discardableResult func task( priority: TaskPriority?, @_inheritActorContext operation: sending @escaping @isolated(any) () async -> Success @@ -42,6 +44,7 @@ import Foundation /// - operation: An asynchronous operation to execute within the task. The operation /// is isolated and does not inherit the current actor context. /// - Returns: A `Task` object that wraps the result or error of the operation. + @discardableResult func detached( priority: TaskPriority?, @_inheritActorContext operation: sending @escaping @isolated(any) () async throws -> Success @@ -54,6 +57,7 @@ import Foundation /// - operation: An asynchronous operation to execute within the task. The operation /// is isolated and does not inherit the current actor context. /// - Returns: A `Task` object that wraps the result of the operation. + @discardableResult func detached( priority: TaskPriority?, @_inheritActorContext operation: sending @escaping @isolated(any) () async -> Success @@ -66,6 +70,7 @@ import Foundation /// that can throw errors. /// - Parameter operation: An asynchronous operation to execute within the task. /// - Returns: A `Task` object that wraps the result or error of the operation. + @discardableResult func task( @_inheritActorContext operation: sending @escaping @isolated(any) () async throws -> Success ) -> Task { @@ -76,6 +81,7 @@ import Foundation /// that does not throw errors. /// - Parameter operation: An asynchronous operation to execute within the task. /// - Returns: A `Task` object that wraps the result of the operation. + @discardableResult func task( @_inheritActorContext operation: sending @escaping @isolated(any) () async -> Success ) -> Task { @@ -86,6 +92,7 @@ import Foundation /// of the current actor context and can throw errors. /// - Parameter operation: An asynchronous operation to execute within the task. /// - Returns: A `Task` object that wraps the result or error of the operation. + @discardableResult func detached( @_inheritActorContext operation: sending @escaping @isolated(any) () async throws -> Success ) -> Task { @@ -96,6 +103,7 @@ import Foundation /// of the current actor context and does not throw errors. /// - Parameter operation: An asynchronous operation to execute within the task. /// - Returns: A `Task` object that wraps the result of the operation. + @discardableResult func detached( @_inheritActorContext operation: sending @escaping @isolated(any) () async -> Success ) -> Task { diff --git a/Sources/Concurrency/TaskFactory/TaskFactory.swift b/Sources/Concurrency/TaskFactory/TaskFactory.swift index 58aa5bb..3ac86c9 100644 --- a/Sources/Concurrency/TaskFactory/TaskFactory.swift +++ b/Sources/Concurrency/TaskFactory/TaskFactory.swift @@ -11,6 +11,7 @@ // MARK: ITaskFactory + @discardableResult public func task( priority: TaskPriority?, @_inheritActorContext operation: sending @escaping @isolated(any) () async throws -> Success @@ -18,6 +19,7 @@ Task(priority: priority, operation: operation) } + @discardableResult public func task( priority: TaskPriority?, @_inheritActorContext operation: sending @escaping @isolated(any) () async -> Success @@ -25,6 +27,7 @@ Task(priority: priority, operation: operation) } + @discardableResult public func detached( priority: TaskPriority?, @_inheritActorContext operation: sending @escaping @isolated(any) () async throws -> Success @@ -32,6 +35,7 @@ Task.detached(priority: priority, operation: operation) } + @discardableResult public func detached( priority: TaskPriority?, @_inheritActorContext operation: sending @escaping @isolated(any) () async -> Success