ProtectedValue
@dynamicMemberLookup
public final class ProtectedValue<Value> : @unchecked Sendable
extension ProtectedValue: Equatable where Value: Equatable
extension ProtectedValue: Hashable where Value: Hashable
线程安全的受保护值包装器
-
Undocumented
Declaration
Swift
public init(_ value: Value)
-
同步方式读取或设置值
Declaration
Swift
public var value: Value { get set }
-
同步闭包方式读取或转换值
Declaration
Swift
public func read<U>(_ closure: (Value) throws -> U) rethrows -> U
-
同步方式读取值
Declaration
Swift
public func read() -> Value
-
同步闭包方式修改值
Declaration
Swift
@discardableResult public func write<U>(_ closure: (inout Value) throws -> U) rethrows -> U
-
同步方式修改值
Declaration
Swift
public func write(_ value: Value)
-
Undocumented
Declaration
Swift
public subscript<Property>(dynamicMember keyPath: WritableKeyPath<Value, Property>) -> Property { get set }
-
Undocumented
Declaration
Swift
public subscript<Property>(dynamicMember keyPath: KeyPath<Value, Property>) -> Property { get }
-
Declaration
Swift
public static func == (lhs: ProtectedValue<Value>, rhs: ProtectedValue<Value>) -> Bool
-
Declaration
Swift
public func hash(into hasher: inout Hasher)