SPB Git

Repository Public

Identifiers.swift 1.4 KB 24 lines swift

1import Foundation23/// A strongly typed, stable identifier. Every entity in NEXTERM (window, tab, pane,4/// session, workspace, split) carries one of these so the UI never has to key on5/// view identity or array position.6public protocol StableID: Hashable, Codable, Sendable, CustomStringConvertible {7    var rawValue: UUID { get }8    init(rawValue: UUID)9}1011extension StableID {12    public init() { self.init(rawValue: UUID()) }13    public var description: String { rawValue.uuidString }14    public var shortString: String { String(rawValue.uuidString.prefix(8)) }15}1617public struct WorkspaceID: StableID { public let rawValue: UUID; public init(rawValue: UUID) { self.rawValue = rawValue } }18public struct WindowID: StableID { public let rawValue: UUID; public init(rawValue: UUID) { self.rawValue = rawValue } }19public struct TabID: StableID { public let rawValue: UUID; public init(rawValue: UUID) { self.rawValue = rawValue } }20public struct PaneID: StableID { public let rawValue: UUID; public init(rawValue: UUID) { self.rawValue = rawValue } }21public struct SessionID: StableID { public let rawValue: UUID; public init(rawValue: UUID) { self.rawValue = rawValue } }22public struct SplitID: StableID { public let rawValue: UUID; public init(rawValue: UUID) { self.rawValue = rawValue } }23public struct HostID: StableID { public let rawValue: UUID; public init(rawValue: UUID) { self.rawValue = rawValue } }24
Files main
Menu

Theme