ミラー元
https://github.com/maxgoedjen/secretive.git
前回の同期 2026-03-25 10:37:23 +01:00
Restore hashable
このコミットが含まれているのは:
@@ -1,4 +1,4 @@
|
||||
public protocol Secret: Identifiable {
|
||||
public protocol Secret: Identifiable, Hashable {
|
||||
|
||||
var name: String { get }
|
||||
var publicKey: Data { get }
|
||||
@@ -9,11 +9,13 @@ public protocol Secret: Identifiable {
|
||||
|
||||
public struct AnySecret: Secret {
|
||||
|
||||
fileprivate let hashable: AnyHashable
|
||||
fileprivate let _id: () -> AnyHashable
|
||||
fileprivate let _name: () -> String
|
||||
fileprivate let _publicKey: () -> Data
|
||||
|
||||
public init<T>(_ secret: T) where T: Secret {
|
||||
self.hashable = secret
|
||||
_id = { secret.id as AnyHashable }
|
||||
_name = { secret.name }
|
||||
_publicKey = { secret.publicKey }
|
||||
@@ -31,5 +33,13 @@ public struct AnySecret: Secret {
|
||||
return _publicKey()
|
||||
}
|
||||
|
||||
public static func == (lhs: AnySecret, rhs: AnySecret) -> Bool {
|
||||
lhs.hashable == rhs.hashable
|
||||
}
|
||||
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
hashable.hash(into: &hasher)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする