@@ -280,21 +280,6 @@ extension _StructuredFieldEncoder: SingleValueEncodingContainer {
280
280
try self . _encodeFixedWidthInteger ( value)
281
281
}
282
282
283
- func encode( _ data: Data ) throws {
284
- let encoded = data. base64EncodedString ( )
285
- try self . currentStackEntry. storage. insertBareItem ( . undecodedByteSequence( encoded) )
286
- }
287
-
288
- func encode( _ data: Decimal ) throws {
289
- let significand = ( data. significand. magnitude as NSNumber ) . intValue // Yes, really.
290
- guard let exponent = Int8 ( exactly: data. exponent) else {
291
- throw StructuredHeaderError . invalidIntegerOrDecimal
292
- }
293
-
294
- let pd = PseudoDecimal ( mantissa: significand * ( data. isSignMinus ? - 1 : 1 ) , exponent: Int ( exponent) )
295
- try self . currentStackEntry. storage. insertBareItem ( . decimal( pd) )
296
- }
297
-
298
283
func encode< T> ( _ value: T ) throws where T: Encodable {
299
284
switch value {
300
285
case let value as UInt8 :
@@ -348,6 +333,23 @@ extension _StructuredFieldEncoder: SingleValueEncodingContainer {
348
333
}
349
334
}
350
335
336
+ extension _StructuredFieldEncoder {
337
+ func encode( _ data: Data ) throws {
338
+ let encoded = data. base64EncodedString ( )
339
+ try self . currentStackEntry. storage. insertBareItem ( . undecodedByteSequence( encoded) )
340
+ }
341
+
342
+ func encode( _ data: Decimal ) throws {
343
+ let significand = ( data. significand. magnitude as NSNumber ) . intValue // Yes, really.
344
+ guard let exponent = Int8 ( exactly: data. exponent) else {
345
+ throw StructuredHeaderError . invalidIntegerOrDecimal
346
+ }
347
+
348
+ let pd = PseudoDecimal ( mantissa: significand * ( data. isSignMinus ? - 1 : 1 ) , exponent: Int ( exponent) )
349
+ try self . currentStackEntry. storage. insertBareItem ( . decimal( pd) )
350
+ }
351
+ }
352
+
351
353
extension _StructuredFieldEncoder {
352
354
// This extension sort-of corresponds to the unkeyed encoding container: all of
353
355
// these methods are called from there.
0 commit comments