11//! `UUID` types.
22
3+ #[ allow( clippy:: module_name_repetitions) ]
4+ pub use uuid_v4:: UuidV4 ;
5+ #[ allow( clippy:: module_name_repetitions) ]
6+ pub use uuid_v7:: UuidV7 ;
7+
38mod uuid_v4;
49mod uuid_v7;
510
611use minicbor:: data:: Tag ;
7- pub use uuid_v4:: UuidV4 as V4 ;
8- pub use uuid_v7:: UuidV7 as V7 ;
912
1013/// Invalid Doc Type UUID
1114pub const INVALID_UUID : uuid:: Uuid = uuid:: Uuid :: from_bytes ( [ 0x00 ; 16 ] ) ;
@@ -90,12 +93,12 @@ fn encode_cbor_uuid<W: minicbor::encode::Write>(
9093#[ cfg( test) ]
9194mod tests {
9295
93- use super :: { V4 , V7 } ;
96+ use super :: * ;
9497 use crate :: uuid:: CborContext ;
9598
9699 #[ test]
97100 fn test_cbor_uuid_v4_roundtrip ( ) {
98- let uuid = V4 :: new ( ) ;
101+ let uuid = UuidV4 :: new ( ) ;
99102 let mut bytes = Vec :: new ( ) ;
100103 minicbor:: encode_with ( uuid, & mut bytes, & mut CborContext :: Untagged ) . unwrap ( ) ;
101104 let decoded = minicbor:: decode_with ( bytes. as_slice ( ) , & mut CborContext :: Untagged ) . unwrap ( ) ;
@@ -104,17 +107,18 @@ mod tests {
104107
105108 #[ test]
106109 fn test_cbor_uuid_v4_invalid_decoding ( ) {
107- let uuid_v7 = V7 :: new ( ) ;
110+ let uuid_v7 = UuidV7 :: new ( ) ;
108111 let mut bytes = Vec :: new ( ) ;
109112 minicbor:: encode_with ( uuid_v7, & mut bytes, & mut CborContext :: Untagged ) . unwrap ( ) ;
110113 assert ! (
111- minicbor:: decode_with:: <_, V4 >( bytes. as_slice( ) , & mut CborContext :: Untagged ) . is_err( )
114+ minicbor:: decode_with:: <_, UuidV4 >( bytes. as_slice( ) , & mut CborContext :: Untagged )
115+ . is_err( )
112116 ) ;
113117 }
114118
115119 #[ test]
116120 fn test_cbor_uuid_v7_roundtrip ( ) {
117- let uuid = V7 :: new ( ) ;
121+ let uuid = UuidV7 :: new ( ) ;
118122 let mut bytes = Vec :: new ( ) ;
119123 minicbor:: encode_with ( uuid, & mut bytes, & mut CborContext :: Untagged ) . unwrap ( ) ;
120124 let decoded = minicbor:: decode_with ( bytes. as_slice ( ) , & mut CborContext :: Untagged ) . unwrap ( ) ;
@@ -123,17 +127,18 @@ mod tests {
123127
124128 #[ test]
125129 fn test_cbor_uuid_v7_invalid_decoding ( ) {
126- let uuid_v4 = V4 :: new ( ) ;
130+ let uuid_v4 = UuidV4 :: new ( ) ;
127131 let mut bytes = Vec :: new ( ) ;
128132 minicbor:: encode_with ( uuid_v4, & mut bytes, & mut CborContext :: Untagged ) . unwrap ( ) ;
129133 assert ! (
130- minicbor:: decode_with:: <_, V7 >( bytes. as_slice( ) , & mut CborContext :: Untagged ) . is_err( )
134+ minicbor:: decode_with:: <_, UuidV7 >( bytes. as_slice( ) , & mut CborContext :: Untagged )
135+ . is_err( )
131136 ) ;
132137 }
133138
134139 #[ test]
135140 fn test_tagged_cbor_uuid_v4_roundtrip ( ) {
136- let uuid = V4 :: new ( ) ;
141+ let uuid = UuidV4 :: new ( ) ;
137142 let mut bytes = Vec :: new ( ) ;
138143 minicbor:: encode_with ( uuid, & mut bytes, & mut CborContext :: Tagged ) . unwrap ( ) ;
139144 let decoded = minicbor:: decode_with ( bytes. as_slice ( ) , & mut CborContext :: Tagged ) . unwrap ( ) ;
@@ -142,7 +147,7 @@ mod tests {
142147
143148 #[ test]
144149 fn test_tagged_cbor_uuid_v7_roundtrip ( ) {
145- let uuid = V7 :: new ( ) ;
150+ let uuid = UuidV7 :: new ( ) ;
146151 let mut bytes = Vec :: new ( ) ;
147152 minicbor:: encode_with ( uuid, & mut bytes, & mut CborContext :: Tagged ) . unwrap ( ) ;
148153 let decoded = minicbor:: decode_with ( bytes. as_slice ( ) , & mut CborContext :: Tagged ) . unwrap ( ) ;
@@ -151,7 +156,7 @@ mod tests {
151156
152157 #[ test]
153158 fn test_optional_cbor_uuid_v4_roundtrip ( ) {
154- let uuid = V4 :: new ( ) ;
159+ let uuid = UuidV4 :: new ( ) ;
155160
156161 let mut bytes = Vec :: new ( ) ;
157162 minicbor:: encode_with ( uuid, & mut bytes, & mut CborContext :: Untagged ) . unwrap ( ) ;
@@ -166,7 +171,7 @@ mod tests {
166171
167172 #[ test]
168173 fn test_optional_cbor_uuid_v7_roundtrip ( ) {
169- let uuid = V7 :: new ( ) ;
174+ let uuid = UuidV7 :: new ( ) ;
170175
171176 let mut bytes = Vec :: new ( ) ;
172177 minicbor:: encode_with ( uuid, & mut bytes, & mut CborContext :: Untagged ) . unwrap ( ) ;
0 commit comments