We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b527467 commit 867848fCopy full SHA for 867848f
Sources/ArgumentEncoding/Option.swift
@@ -227,6 +227,20 @@ extension Option: ExpressibleByStringInterpolation where Value: StringProtocol {
227
}
228
229
230
+extension Option: Decodable where Value: Decodable & CustomStringConvertible {
231
+ public init(from decoder: Decoder) throws {
232
+ let container = try decoder.singleValueContainer()
233
+ self.init(wrappedValue: try container.decode(Value.self))
234
+ }
235
+}
236
+
237
+extension Option: Encodable where Value: Encodable {
238
+ public func encode(to encoder: Encoder) throws {
239
+ var container = encoder.singleValueContainer()
240
+ try container.encode(wrappedValue)
241
242
243
244
// MARK: Internal Types
245
246
/*
0 commit comments