Skip to content

Instance Method

set(_:to:onShutdown:)

Set or remove a value for a given key, optionally providing a shutdown closure for the value.
mutating func set<Key>(_ key: Key.Type, to value: Key.Value?, onShutdown: (@Sendable (Key.Value) throws -> ())? = nil) where Key : StorageKey

Discussion

If a key that has a shutdown closure is removed by this method, the closure is invoked.