-
Type: New Feature
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: BSON
-
None
As an ergonomic improvement, we should implement From<Option<T>> for Bson for T that can be converted into Bson, returning Bson::Null in the None case.
This would allow Option to more easily be used in the doc! macro:
let x: Option<i32> = None; // current doc! { "x": x }; // compile error, Bson: From<Option<i32>> not satisfied // proposed doc! { "x": x }; // { "x": null }