File tree Expand file tree Collapse file tree 4 files changed +30
-7
lines changed
Expand file tree Collapse file tree 4 files changed +30
-7
lines changed Original file line number Diff line number Diff line change @@ -30,5 +30,7 @@ mysql = ["benzina-derive?/mysql"]
3030serde = [" dep:serde" , " uuid?/serde" ]
3131utoipa = [" dep:utoipa" ]
3232
33+ example-generated = [" typed-uuid" ]
34+
3335[lints ]
3436workspace = true
Original file line number Diff line number Diff line change 1+ use crate :: typed_uuid;
2+
3+ typed_uuid ! (
4+ /// A example struct generated by [`typed_uuid`].
5+ pub FooId
6+ ) ;
Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ pub use benzina_derive::Enum;
55
66#[ cfg( feature = "postgres" ) ]
77pub mod error;
8+ #[ cfg( feature = "example-generated" ) ]
9+ /// This module shows an example of code generated by the [`typed_uuid`] macro. IT **MUST NOT BE
10+ /// USED OUTSIDE THIS CRATE**.
11+ pub mod example_generated;
812#[ cfg( feature = "postgres" ) ]
913mod int;
1014#[ cfg( all( feature = "serde" , feature = "postgres" ) ) ]
Original file line number Diff line number Diff line change 88/// order to provide the guarantee that the `UUID` is valid. However, it is possible to choose to
99/// add traits and methods to customize the behavior.
1010///
11+ #[ cfg_attr(
12+ not( feature = "example-generated" ) ,
13+ doc = "To see the documentation of a generated typed `UUID`, consider re-building the \
14+ documentation with the feature `example-generated` enabled."
15+ ) ]
16+ #[ cfg_attr(
17+ feature = "example-generated" ,
18+ doc = "You can see the documentation for an example generated `UUID` struct \
19+ [`here`](crate::example_generated::FooId)."
20+ ) ]
21+ ///
1122/// [`Uuid`]: ::uuid::Uuid
1223///
1324/// # Examples
@@ -146,12 +157,12 @@ macro_rules! typed_uuid {
146157
147158 $crate:: __typed_uuid__forward_from!(
148159 $name:
149- :: uuid:: fmt:: Braced ,
150- :: uuid:: fmt:: Hyphenated ,
151- :: uuid:: fmt:: Simple ,
152- :: uuid:: fmt:: Urn ,
153- :: std:: string:: String ,
154- :: std:: vec:: Vec <u8 >,
160+ :: uuid:: fmt:: Braced ,
161+ :: uuid:: fmt:: Hyphenated ,
162+ :: uuid:: fmt:: Simple ,
163+ :: uuid:: fmt:: Urn ,
164+ :: std:: string:: String ,
165+ :: std:: vec:: Vec <u8 >,
155166 ) ;
156167
157168 impl :: std:: fmt:: Display for $name {
@@ -173,7 +184,7 @@ macro_rules! typed_uuid {
173184 }
174185
175186 $crate:: __typed_uuid__impl_serde!( $name) ;
176- ) +
187+ ) +
177188 } ;
178189}
179190
You can’t perform that action at this time.
0 commit comments