feat: add support for cbor extracting to optionals
This commit is contained in:
parent
08dd84ef20
commit
2e19486363
1 changed files with 9 additions and 0 deletions
|
@ -714,6 +714,15 @@ fn Extractor(comptime T: type) type {
|
|||
},
|
||||
else => extractError(T),
|
||||
},
|
||||
.Optional => |opt_info| {
|
||||
var nested: opt_info.child = undefined;
|
||||
const extractor = Extractor(opt_info.child).init(&nested);
|
||||
if (try extractor.extract(iter)) {
|
||||
self.dest.* = nested;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
else => extractError(T),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue