SerialNumber

public struct SerialNumber<Number> : RawRepresentable where Number : FixedWidthInteger, Number : UnsignedInteger
extension SerialNumber: Comparable
extension SerialNumber: Hashable where Number: Hashable
extension SerialNumber: Encodable where Number: Encodable
extension SerialNumber: Decodable where Number: Decodable
extension SerialNumber: ExpressibleByIntegerLiteral where Number: _ExpressibleByBuiltinIntegerLiteral

Implementation of Serial Number Arithmetic as defined in RFC 1982 https://tools.ietf.org/html/rfc1982

  • Declaration

    Swift

    public var rawValue: Number
  • Declaration

    Swift

    public init(rawValue: Number)
  • Addition as defined in RFC 1982: (lhs + rhs) modulo (2^Number.bitWidth). Addition of a value greater than or equal to 2^(Number.bitWidth - 1) is undefined.

    Declaration

    Swift

    public static func + (lhs: `Self`, rhs: `Self`) -> SerialNumber<Number>
  • Addition as defined in RFC 1982: (lhs + rhs) modulo (2^Number.bitWidth). Addition of a value greater than or equal to 2^(Number.bitWidth - 1) is undefined.

    Declaration

    Swift

    public static func += (lhs: inout `Self`, rhs: `Self`)
  • Addition as defined in RFC 1982: (lhs + rhs) modulo (2^Number.bitWidth) with overflow reporting. Addition of a value greater than or equal to 2^(Number.bitWidth - 1) is undefined.

    Declaration

    Swift

    public func addingReportingOverflow(_ rhs: `Self`) -> (number: `Self`, overflow: Bool)
  • Comparision as defined in RFC 1982.

    Declaration

    Swift

    public static func < (lhs: `Self`, rhs: `Self`) -> Bool

Available where Number: Encodable

  • Declaration

    Swift

    public func encode(to encoder: Encoder) throws

Available where Number: Decodable

  • Declaration

    Swift

    public init(from decoder: Decoder) throws

Available where Number: _ExpressibleByBuiltinIntegerLiteral