@@ -405,14 +405,16 @@ extension Range: Hashable where Bound: Hashable {
405
405
}
406
406
}
407
407
408
- extension Range : Codable where Bound: Codable {
408
+ extension Range : Decodable where Bound: Decodable {
409
409
public init ( from decoder: Decoder ) throws {
410
410
var container = try decoder. unkeyedContainer ( )
411
411
let lowerBound = try container. decode ( Bound . self)
412
412
let upperBound = try container. decode ( Bound . self)
413
413
self = lowerBound..< upperBound
414
414
}
415
+ }
415
416
417
+ extension Range : Encodable where Bound: Encodable {
416
418
public func encode( to encoder: Encoder ) throws {
417
419
var container = encoder. unkeyedContainer ( )
418
420
try container. encode ( self . lowerBound)
@@ -462,12 +464,14 @@ extension PartialRangeUpTo: RangeExpression {
462
464
}
463
465
}
464
466
465
- extension PartialRangeUpTo : Codable where Bound: Codable {
467
+ extension PartialRangeUpTo : Decodable where Bound: Decodable {
466
468
public init ( from decoder: Decoder ) throws {
467
469
var container = try decoder. unkeyedContainer ( )
468
470
self = try ( ..< container. decode ( Bound . self) )
469
471
}
472
+ }
470
473
474
+ extension PartialRangeUpTo : Encodable where Bound: Encodable {
471
475
public func encode( to encoder: Encoder ) throws {
472
476
var container = encoder. unkeyedContainer ( )
473
477
try container. encode ( self . upperBound)
@@ -515,12 +519,14 @@ extension PartialRangeThrough: RangeExpression {
515
519
}
516
520
}
517
521
518
- extension PartialRangeThrough : Codable where Bound: Codable {
522
+ extension PartialRangeThrough : Decodable where Bound: Decodable {
519
523
public init ( from decoder: Decoder ) throws {
520
524
var container = try decoder. unkeyedContainer ( )
521
525
self = try ( ... container. decode ( Bound . self) )
522
526
}
527
+ }
523
528
529
+ extension PartialRangeThrough : Encodable where Bound: Encodable {
524
530
public func encode( to encoder: Encoder ) throws {
525
531
var container = encoder. unkeyedContainer ( )
526
532
try container. encode ( self . upperBound)
@@ -663,12 +669,14 @@ extension PartialRangeFrom: Sequence
663
669
}
664
670
}
665
671
666
- extension PartialRangeFrom : Codable where Bound: Codable {
672
+ extension PartialRangeFrom : Decodable where Bound: Decodable {
667
673
public init ( from decoder: Decoder ) throws {
668
674
var container = try decoder. unkeyedContainer ( )
669
675
self = try container. decode ( Bound . self) ...
670
676
}
677
+ }
671
678
679
+ extension PartialRangeFrom : Encodable where Bound: Encodable {
672
680
public func encode( to encoder: Encoder ) throws {
673
681
var container = encoder. unkeyedContainer ( )
674
682
try container. encode ( self . lowerBound)
0 commit comments