| 1 | use craterust-analyzer cargo schemars 1.2.2 crate/::{json_schemarust-analyzer cargo schemars 1.2.2 macros/json_schema!, JsonSchemarust-analyzer cargo schemars 1.2.2 JsonSchema#, Schemarust-analyzer cargo schemars 1.2.2 schema/Schema#, SchemaGeneratorrust-analyzer cargo schemars 1.2.2 generate/SchemaGenerator#}; |
| 2 | use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#; |
| 3 | use jiff02rust-analyzer cargo jiff 0.2.35 crate/::civilrust-analyzer cargo jiff 0.2.35 civil/::{Daterust-analyzer cargo jiff 0.2.35 civil/date/Date#, DateTimerust-analyzer cargo jiff 0.2.35 civil/datetime/DateTime#, Timerust-analyzer cargo jiff 0.2.35 civil/time/Time#}; |
| 4 | use jiff02rust-analyzer cargo jiff 0.2.35 crate/::{SignedDurationrust-analyzer cargo jiff 0.2.35 signed_duration/SignedDuration#, Spanrust-analyzer cargo jiff 0.2.35 span/Span#, Timestamprust-analyzer cargo jiff 0.2.35 timestamp/Timestamp#, Zonedrust-analyzer cargo jiff 0.2.35 zoned/Zoned#}; |
| 5 | |
| 6 | macro_rules! formatted_string_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/jiff02/formatted_string_impl! { |
| 7 | ($ty:ident, $format:literal) => { |
| 8 | formatted_string_impl!($ty, $format, JsonSchema for $ty); |
| 9 | }; |
| 10 | ($ty:ident, $format:literal, $($desc:tt)+) => { |
| 11 | impl $($desc)+ { |
| 12 | inline_schema!(); |
| 13 | |
| 14 | fn schema_name() -> Cow<'static, str> { |
| 15 | stringify!($ty).into() |
| 16 | } |
| 17 | |
| 18 | fn schema_id() -> Cow<'static, str> { |
| 19 | stringify!(jiff::$ty).into() |
| 20 | } |
| 21 | |
| 22 | fn json_schema(_: &mut SchemaGenerator) -> Schema { |
| 23 | json_schema!({ |
| 24 | "type": "string", |
| 25 | "format": $format |
| 26 | }) |
| 27 | } |
| 28 | } |
| 29 | }; |
| 30 | } |
| 31 | |
| 32 | formatted_string_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/jiff02/formatted_string_impl!!(SignedDurationrust-analyzer cargo jiff 0.2.35 signed_duration/SignedDuration#, "duration"); |
| 33 | formatted_string_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/jiff02/formatted_string_impl!!(Spanrust-analyzer cargo jiff 0.2.35 span/Span#, "duration"); |
| 34 | formatted_string_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/jiff02/formatted_string_impl!!(Timestamprust-analyzer cargo jiff 0.2.35 timestamp/Timestamp#, "date-time"); |
| 35 | formatted_string_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/jiff02/formatted_string_impl!!(Zonedrust-analyzer cargo jiff 0.2.35 zoned/Zoned#, "zoned-date-time"); |
| 36 | formatted_string_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/jiff02/formatted_string_impl!!(Daterust-analyzer cargo jiff 0.2.35 civil/date/Date#, "date"); |
| 37 | formatted_string_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/jiff02/formatted_string_impl!!(Timerust-analyzer cargo jiff 0.2.35 civil/time/Time#, "partial-time"); |
| 38 | formatted_string_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/jiff02/formatted_string_impl!!(DateTimerust-analyzer cargo jiff 0.2.35 civil/datetime/DateTime#, "partial-date-time"); |