@@ -514,7 +514,7 @@ impl Bson {
514514 }
515515 }
516516
517- /// Get the `ElementType` of this value.
517+ /// Get the [ `ElementType`] of this value.
518518 pub fn element_type ( & self ) -> ElementType {
519519 match * self {
520520 Bson :: Double ( ..) => ElementType :: Double ,
@@ -841,152 +841,159 @@ impl Bson {
841841
842842/// Value helpers
843843impl Bson {
844- /// If `Bson` is `Double`, return its value as an `f64`. Returns `None` otherwise
844+ /// If `self` is [`Double`](Bson::Double), return its value as an `f64`. Returns [`None`]
845+ /// otherwise.
845846 pub fn as_f64 ( & self ) -> Option < f64 > {
846847 match * self {
847848 Bson :: Double ( v) => Some ( v) ,
848849 _ => None ,
849850 }
850851 }
851852
852- /// If `Bson` is `String`, return its value as a `&str`. Returns `None` otherwise
853+ /// If `self` is [`String`](Bson::String), return its value as a `&str`. Returns [`None`]
854+ /// otherwise.
853855 pub fn as_str ( & self ) -> Option < & str > {
854856 match * self {
855857 Bson :: String ( ref s) => Some ( s) ,
856858 _ => None ,
857859 }
858860 }
859861
860- /// If `Bson ` is `String`, return a mutable reference to its value as a `str`. Returns `None`
861- /// otherwise
862+ /// If `self ` is [ `String`](Bson::String) , return a mutable reference to its value as a [ `str`].
863+ /// Returns [`None`] otherwise.
862864 pub fn as_str_mut ( & mut self ) -> Option < & mut str > {
863865 match * self {
864866 Bson :: String ( ref mut s) => Some ( s) ,
865867 _ => None ,
866868 }
867869 }
868870
869- /// If `Bson ` is `Array`, return its value. Returns `None` otherwise
871+ /// If `self ` is [ `Array`](Bson::Array) , return its value. Returns [ `None`] otherwise.
870872 pub fn as_array ( & self ) -> Option < & Array > {
871873 match * self {
872874 Bson :: Array ( ref v) => Some ( v) ,
873875 _ => None ,
874876 }
875877 }
876878
877- /// If `Bson` is `Array`, return a mutable reference to its value. Returns `None` otherwise
879+ /// If `self` is [`Array`](Bson::Array), return a mutable reference to its value. Returns
880+ /// [`None`] otherwise.
878881 pub fn as_array_mut ( & mut self ) -> Option < & mut Array > {
879882 match * self {
880883 Bson :: Array ( ref mut v) => Some ( v) ,
881884 _ => None ,
882885 }
883886 }
884887
885- /// If `Bson ` is `Document`, return its value. Returns `None` otherwise
888+ /// If `self ` is [ `Document`](Bson::Document) , return its value. Returns [ `None`] otherwise.
886889 pub fn as_document ( & self ) -> Option < & Document > {
887890 match * self {
888891 Bson :: Document ( ref v) => Some ( v) ,
889892 _ => None ,
890893 }
891894 }
892895
893- /// If `Bson` is `Document`, return a mutable reference to its value. Returns `None` otherwise
896+ /// If `self` is [`Document`](Bson::Document), return a mutable reference to its value. Returns
897+ /// [`None`] otherwise.
894898 pub fn as_document_mut ( & mut self ) -> Option < & mut Document > {
895899 match * self {
896900 Bson :: Document ( ref mut v) => Some ( v) ,
897901 _ => None ,
898902 }
899903 }
900904
901- /// If `Bson ` is `Bool` , return its value. Returns `None` otherwise
905+ /// If `self ` is [`Boolean`](Bson::Boolean) , return its value. Returns [ `None`] otherwise.
902906 pub fn as_bool ( & self ) -> Option < bool > {
903907 match * self {
904908 Bson :: Boolean ( v) => Some ( v) ,
905909 _ => None ,
906910 }
907911 }
908912
909- /// If `Bson ` is `I32` , return its value. Returns `None` otherwise
913+ /// If `self ` is [`Int32`](Bson::Int32) , return its value. Returns [ `None`] otherwise.
910914 pub fn as_i32 ( & self ) -> Option < i32 > {
911915 match * self {
912916 Bson :: Int32 ( v) => Some ( v) ,
913917 _ => None ,
914918 }
915919 }
916920
917- /// If `Bson ` is `I64` , return its value. Returns `None` otherwise
921+ /// If `self ` is [`Int64`](Bson::Int64) , return its value. Returns [ `None`] otherwise.
918922 pub fn as_i64 ( & self ) -> Option < i64 > {
919923 match * self {
920924 Bson :: Int64 ( v) => Some ( v) ,
921925 _ => None ,
922926 }
923927 }
924928
925- /// If `Bson ` is `Objectid` , return its value. Returns `None` otherwise
929+ /// If `self ` is [`ObjectId`](Bson::ObjectId) , return its value. Returns [ `None`] otherwise.
926930 pub fn as_object_id ( & self ) -> Option < oid:: ObjectId > {
927931 match * self {
928932 Bson :: ObjectId ( v) => Some ( v) ,
929933 _ => None ,
930934 }
931935 }
932936
933- /// If `Bson` is `Objectid`, return a mutable reference to its value. Returns `None` otherwise
937+ /// If `self` is [`ObjectId`](Bson::ObjectId), return a mutable reference to its value. Returns
938+ /// [`None`] otherwise.
934939 pub fn as_object_id_mut ( & mut self ) -> Option < & mut oid:: ObjectId > {
935940 match * self {
936941 Bson :: ObjectId ( ref mut v) => Some ( v) ,
937942 _ => None ,
938943 }
939944 }
940945
941- /// If `Bson ` is `DateTime`, return its value. Returns `None` otherwise
946+ /// If `self ` is [ `DateTime`](Bson::DateTime) , return its value. Returns [ `None`] otherwise.
942947 pub fn as_datetime ( & self ) -> Option < & crate :: DateTime > {
943948 match * self {
944949 Bson :: DateTime ( ref v) => Some ( v) ,
945950 _ => None ,
946951 }
947952 }
948953
949- /// If `Bson ` is `DateTime`, return a mutable reference to its value. Returns `None`
950- /// otherwise
954+ /// If `self ` is [ `DateTime`](Bson::DateTime) , return a mutable reference to its value. Returns
955+ /// [`None`] otherwise.
951956 pub fn as_datetime_mut ( & mut self ) -> Option < & mut crate :: DateTime > {
952957 match * self {
953958 Bson :: DateTime ( ref mut v) => Some ( v) ,
954959 _ => None ,
955960 }
956961 }
957962
958- /// If `Bson ` is `Symbol`, return its value. Returns `None` otherwise
963+ /// If `self ` is [ `Symbol`](Bson::Symbol) , return its value. Returns [ `None`] otherwise.
959964 pub fn as_symbol ( & self ) -> Option < & str > {
960965 match * self {
961966 Bson :: Symbol ( ref v) => Some ( v) ,
962967 _ => None ,
963968 }
964969 }
965970
966- /// If `Bson` is `Symbol`, return a mutable reference to its value. Returns `None` otherwise
971+ /// If `self` is [`Symbol`](Bson::Symbol), return a mutable reference to its value. Returns
972+ /// [`None`] otherwise.
967973 pub fn as_symbol_mut ( & mut self ) -> Option < & mut str > {
968974 match * self {
969975 Bson :: Symbol ( ref mut v) => Some ( v) ,
970976 _ => None ,
971977 }
972978 }
973979
974- /// If `Bson ` is `Timestamp`, return its value. Returns `None` otherwise
980+ /// If `self ` is [ `Timestamp`](Bson::Timestamp) , return its value. Returns [ `None`] otherwise.
975981 pub fn as_timestamp ( & self ) -> Option < Timestamp > {
976982 match * self {
977983 Bson :: Timestamp ( timestamp) => Some ( timestamp) ,
978984 _ => None ,
979985 }
980986 }
981987
982- /// If `Bson ` is `Null`, return its value . Returns `None` otherwise
988+ /// If `self ` is [ `Null`](Bson::Null) , return `()` . Returns [ `None`] otherwise.
983989 pub fn as_null ( & self ) -> Option < ( ) > {
984990 match * self {
985991 Bson :: Null => Some ( ( ) ) ,
986992 _ => None ,
987993 }
988994 }
989995
996+ /// If `self` is [`DbPointer`](Bson::DbPointer), return its value. Returns [`None`] otherwise.
990997 pub fn as_db_pointer ( & self ) -> Option < & DbPointer > {
991998 match self {
992999 Bson :: DbPointer ( ref db_pointer) => Some ( db_pointer) ,
0 commit comments