mirror of
https://github.com/apple/container.git
synced 2026-09-12 18:55:43 +00:00
Make IP/CIDR types conform to Codable (#454)
These types can benefit from swift's automatic synthesis as the properties already conform to Codable. This will give some flexibility for clients using these types to not have to add extension and implement the encoding / decoding separately.
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
/// Describes an IPv4 CIDR address block.
|
||||
@frozen
|
||||
public struct CIDRv4: CustomStringConvertible, Equatable, Sendable, Hashable {
|
||||
public struct CIDRv4: CustomStringConvertible, Equatable, Sendable, Hashable, Codable {
|
||||
/// The IP component of this CIDR address.
|
||||
public let address: IPv4Address
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
/// Describes an IPv4 or IPv6 CIDR address block.
|
||||
@frozen
|
||||
public struct CIDRv6: CustomStringConvertible, Equatable, Sendable, Hashable {
|
||||
public struct CIDRv6: CustomStringConvertible, Equatable, Sendable, Hashable, Codable {
|
||||
|
||||
/// The IP component of this CIDR address.
|
||||
public let address: IPv6Address
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@frozen
|
||||
public struct IPv4Address: Sendable, Hashable, CustomStringConvertible, Equatable, Comparable {
|
||||
public struct IPv4Address: Sendable, Hashable, CustomStringConvertible, Equatable, Comparable, Codable {
|
||||
public let value: UInt32
|
||||
|
||||
@inlinable
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// Represents an IPv6 network address conforming to RFC 5952 and RFC 4291.
|
||||
public struct IPv6Address: Sendable, Hashable, CustomStringConvertible, Equatable, Comparable {
|
||||
public struct IPv6Address: Sendable, Hashable, CustomStringConvertible, Equatable, Comparable, Codable {
|
||||
@usableFromInline
|
||||
internal let value: UInt128
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
/// CIDR prefix length (e.g., `/24` for a 24-bit network mask).
|
||||
@frozen
|
||||
public struct Prefix: Sendable, CustomStringConvertible, Hashable {
|
||||
public struct Prefix: Sendable, CustomStringConvertible, Hashable, Codable {
|
||||
public let length: UInt8
|
||||
|
||||
/// Create a prefix (0-128). Use `ipv4(_:)` or `ipv6(_:)` for version-specific validation.
|
||||
|
||||
Reference in New Issue
Block a user