1
0

Identifiers.swift 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // This source file is part of the Swift System open source project
  4. //
  5. // Copyright (c) 2025 - 2026 Apple Inc. and the Swift System project authors
  6. // Licensed under Apache License v2.0 with Runtime Library Exception
  7. //
  8. // See https://swift.org/LICENSE.txt for license information
  9. //
  10. //===----------------------------------------------------------------------===//
  11. #if !os(Windows)
  12. /// A Swift wrapper of the C `uid_t` type.
  13. @frozen
  14. @available(System 1.7.0, *)
  15. public struct UserID: RawRepresentable, Sendable, Hashable, Codable {
  16. /// The raw C `uid_t`.
  17. @_alwaysEmitIntoClient
  18. public var rawValue: CInterop.UserID
  19. /// Creates a strongly-typed `UserID` from the raw C value.
  20. @_alwaysEmitIntoClient
  21. public init(rawValue: CInterop.UserID) { self.rawValue = rawValue }
  22. /// Creates a strongly-typed `UserID` from the raw C value.
  23. @_alwaysEmitIntoClient
  24. public init(_ rawValue: CInterop.UserID) { self.rawValue = rawValue }
  25. }
  26. /// A Swift wrapper of the C `gid_t` type.
  27. @frozen
  28. @available(System 1.7.0, *)
  29. public struct GroupID: RawRepresentable, Sendable, Hashable, Codable {
  30. /// The raw C `gid_t`.
  31. @_alwaysEmitIntoClient
  32. public var rawValue: CInterop.GroupID
  33. /// Creates a strongly-typed `GroupID` from the raw C value.
  34. @_alwaysEmitIntoClient
  35. public init(rawValue: CInterop.GroupID) { self.rawValue = rawValue }
  36. /// Creates a strongly-typed `GroupID` from the raw C value.
  37. @_alwaysEmitIntoClient
  38. public init(_ rawValue: CInterop.GroupID) { self.rawValue = rawValue }
  39. }
  40. /// A Swift wrapper of the C `dev_t` type.
  41. @frozen
  42. @available(System 1.7.0, *)
  43. public struct DeviceID: RawRepresentable, Sendable, Hashable, Codable {
  44. /// The raw C `dev_t`.
  45. @_alwaysEmitIntoClient
  46. public var rawValue: CInterop.DeviceID
  47. /// Creates a strongly-typed `DeviceID` from the raw C value.
  48. @_alwaysEmitIntoClient
  49. public init(rawValue: CInterop.DeviceID) { self.rawValue = rawValue }
  50. /// Creates a strongly-typed `DeviceID` from the raw C value.
  51. @_alwaysEmitIntoClient
  52. public init(_ rawValue: CInterop.DeviceID) { self.rawValue = rawValue }
  53. }
  54. /// A Swift wrapper of the C `ino_t` type.
  55. @frozen
  56. @available(System 1.7.0, *)
  57. public struct Inode: RawRepresentable, Sendable, Hashable, Codable {
  58. /// The raw C `ino_t`.
  59. @_alwaysEmitIntoClient
  60. public var rawValue: CInterop.Inode
  61. /// Creates a strongly-typed `Inode` from the raw C value.
  62. @_alwaysEmitIntoClient
  63. public init(rawValue: CInterop.Inode) { self.rawValue = rawValue }
  64. /// Creates a strongly-typed `Inode` from the raw C value.
  65. @_alwaysEmitIntoClient
  66. public init(_ rawValue: CInterop.Inode) { self.rawValue = rawValue }
  67. }
  68. #endif // !os(Windows)