@@ -31,22 +31,27 @@ pub use uuid_1_as_python_legacy_binary::{
31
31
serialize as serialize_uuid_1_as_python_legacy_binary,
32
32
} ;
33
33
34
+ /// Type converters for serializing and deserializing [`crate::oid::ObjectId`] using
35
+ /// [`serde_with::serde_as`].
36
+ ///
37
+ /// ## Available converters
38
+ /// - [`object_id::AsHexString`] — converts an [`crate::oid::ObjectId`] to and from a hex string.
39
+ /// - [`object_id::FromHexString`] — converts a hex string to and from an [`crate::oid::ObjectId`].
34
40
#[ cfg( feature = "serde_with-3" ) ]
41
+ #[ cfg_attr( docsrs, doc( cfg( feature = "serde_with-3" ) ) ) ]
35
42
pub mod object_id {
36
43
use crate :: { macros:: serde_conv_doc, oid:: ObjectId } ;
37
44
use serde:: { Deserialize , Deserializer , Serialize , Serializer } ;
38
45
use serde_with:: { DeserializeAs , SerializeAs } ;
39
46
40
47
serde_conv_doc ! (
41
- /// Contains functions to serialize an ObjectId as a hex string and deserialize an
42
- /// ObjectId from a hex string
48
+ /// Converts an [`ObjectId`] to and from a hex string.
43
49
/// ```rust
44
50
/// # #[cfg(feature = "serde_with-3")]
45
- /// {
46
- /// # use serde::{Serialize, Deserialize};
47
- /// # use bson::serde_helpers::object_id;
48
- /// # use serde_with::serde_as;
49
- /// # use bson::oid::ObjectId;
51
+ /// # {
52
+ /// use bson::{serde_helpers::object_id, oid::ObjectId};
53
+ /// use serde::{Serialize, Deserialize};
54
+ /// use serde_with::serde_as;
50
55
/// #[serde_as]
51
56
/// #[derive(Serialize, Deserialize)]
52
57
/// struct Item {
@@ -66,14 +71,13 @@ pub mod object_id {
66
71
) ;
67
72
68
73
serde_conv_doc ! (
69
- /// Contains functions to serialize a hex string as an ObjectId and deserialize a
70
- /// hex string from an ObjectId
74
+ /// Converts a hex string to and from an [`ObjectId`].
71
75
/// ```rust
72
76
/// # #[cfg(feature = "serde_with-3")]
73
- /// {
74
- /// # use serde::{Serialize, Deserialize} ;
75
- /// # use bson::serde_helpers::object_id ;
76
- /// # use serde_with::serde_as;
77
+ /// # {
78
+ /// use bson::serde_helpers::object_id ;
79
+ /// use serde::{Serialize, Deserialize} ;
80
+ /// use serde_with::serde_as;
77
81
/// #[serde_as]
78
82
/// #[derive(Serialize, Deserialize)]
79
83
/// struct Item {
0 commit comments