FunctionCallable
@dynamicCallable
public struct FunctionCallable : Sendable
Structure enabling the following syntactic sugar for user functions:
guard case let .int32(sum) = try await user.functions.sum([1, 2, 3, 4, 5]) else {
return
}
The dynamic member name (sum
in the above example) is provided by @dynamicMemberLookup
which is directly associated with the function name.
-
The implementation of @dynamicCallable that allows for
Future<AnyBSON, Error>
callable return.let cancellable = user.functions.sum(1, 2, 3, 4, 5) .sink(receiveCompletion: { result in }, receiveValue: { value in // Returned value from function })
Declaration
-
dynamicallyCall(withArguments:
Asynchronous) The implementation of @dynamicMemberLookup that allows for
async await
callable return.guard case let .int32(sum) = try await user.functions.sum(1, 2, 3, 4, 5) else { return }
Declaration