feat: add support for cbor extracting to optionals
This commit is contained in:
parent
d159ba0632
commit
1a769c056a
1 changed files with 9 additions and 0 deletions
|
@ -714,6 +714,15 @@ fn Extractor(comptime T: type) type {
|
||||||
},
|
},
|
||||||
else => extractError(T),
|
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),
|
else => extractError(T),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue