| 1 | use craterust-analyzer cargo schemars 1.2.2 crate/::SchemaGeneratorrust-analyzer cargo schemars 1.2.2 generate/SchemaGenerator#; |
| 2 | 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#}; |
| 3 | 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#; |
| 4 | use chrono04rust-analyzer cargo chrono 0.4.45 crate/::{preluderust-analyzer cargo chrono 0.4.45 prelude/::*, TimeDeltarust-analyzer cargo chrono 0.4.45 time_delta/TimeDelta#}; |
| 5 | |
| 6 | impl JsonSchemarust-analyzer cargo schemars 1.2.2 JsonSchema# for Weekdayrust-analyzer cargo chrono 0.4.45 weekday/Weekday# { |
| 7 | inline_schemarust-analyzer cargo schemars 1.2.2 json_schema_impls/inline_schema!!(); |
| 8 | |
| 9 | fn schema_namerust-analyzer cargo schemars 1.2.2 json_schema_impls/chrono04/impl#[Weekday][JsonSchema]schema_name().() -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str> { |
| 10 | "Weekday".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 11 | } |
| 12 | |
| 13 | fn schema_idrust-analyzer cargo schemars 1.2.2 json_schema_impls/chrono04/impl#[Weekday][JsonSchema]schema_id().() -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str> { |
| 14 | "chrono::Weekday".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 15 | } |
| 16 | |
| 17 | fn json_schemarust-analyzer cargo schemars 1.2.2 json_schema_impls/chrono04/impl#[Weekday][JsonSchema]json_schema().(_: &mut SchemaGeneratorrust-analyzer cargo schemars 1.2.2 generate/SchemaGenerator#) -> Schemarust-analyzer cargo schemars 1.2.2 schema/Schema# { |
| 18 | json_schemarust-analyzer cargo schemars 1.2.2 macros/json_schema!!({ |
| 19 | "type": "string", |
| 20 | "enum": [ |
| 21 | "Mon", |
| 22 | "Tue", |
| 23 | "Wed", |
| 24 | "Thu", |
| 25 | "Fri", |
| 26 | "Sat", |
| 27 | "Sun", |
| 28 | ] |
| 29 | }) |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | impl JsonSchemarust-analyzer cargo schemars 1.2.2 JsonSchema# for TimeDeltarust-analyzer cargo chrono 0.4.45 time_delta/TimeDelta# { |
| 34 | inline_schemarust-analyzer cargo schemars 1.2.2 json_schema_impls/inline_schema!!(); |
| 35 | |
| 36 | fn schema_namerust-analyzer cargo schemars 1.2.2 json_schema_impls/chrono04/impl#[TimeDelta][JsonSchema]schema_name().() -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str> { |
| 37 | "TimeDelta".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 38 | } |
| 39 | |
| 40 | fn schema_idrust-analyzer cargo schemars 1.2.2 json_schema_impls/chrono04/impl#[TimeDelta][JsonSchema]schema_id().() -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'static, str> { |
| 41 | "chrono::TimeDelta".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 42 | } |
| 43 | |
| 44 | fn json_schemarust-analyzer cargo schemars 1.2.2 json_schema_impls/chrono04/impl#[TimeDelta][JsonSchema]json_schema().(_: &mut SchemaGeneratorrust-analyzer cargo schemars 1.2.2 generate/SchemaGenerator#) -> Schemarust-analyzer cargo schemars 1.2.2 schema/Schema# { |
| 45 | json_schemarust-analyzer cargo schemars 1.2.2 macros/json_schema!!({ |
| 46 | "type": "array", |
| 47 | "prefixItems": [ |
| 48 | { |
| 49 | "type": "integer", |
| 50 | "format": "int64" |
| 51 | }, |
| 52 | { |
| 53 | "type": "integer", |
| 54 | "minimum": 0, |
| 55 | "exclusiveMaximum": 1_000_000_000 |
| 56 | } |
| 57 | ], |
| 58 | "minItems": 2, |
| 59 | "maxItems": 2 |
| 60 | }) |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | macro_rules! formatted_string_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/chrono04/formatted_string_impl! { |
| 65 | ($ty:ident, $format:literal) => { |
| 66 | formatted_string_impl!($ty, $format, JsonSchema for $ty); |
| 67 | }; |
| 68 | ($ty:ident, $format:literal, $($desc:tt)+) => { |
| 69 | impl $($desc)+ { |
| 70 | inline_schema!(); |
| 71 | |
| 72 | fn schema_name() -> Cow<'static, str> { |
| 73 | stringify!($ty).into() |
| 74 | } |
| 75 | |
| 76 | fn schema_id() -> Cow<'static, str> { |
| 77 | stringify!(chrono::$ty).into() |
| 78 | } |
| 79 | |
| 80 | fn json_schema(_: &mut SchemaGenerator) -> Schema { |
| 81 | json_schema!({ |
| 82 | "type": "string", |
| 83 | "format": $format |
| 84 | }) |
| 85 | } |
| 86 | } |
| 87 | }; |
| 88 | } |
| 89 | |
| 90 | formatted_string_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/chrono04/formatted_string_impl!!(NaiveDaterust-analyzer cargo chrono 0.4.45 naive/date/NaiveDate#, "date"); |
| 91 | formatted_string_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/chrono04/formatted_string_impl!!(NaiveDateTimerust-analyzer cargo chrono 0.4.45 naive/datetime/NaiveDateTime#, "partial-date-time"); |
| 92 | formatted_string_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/chrono04/formatted_string_impl!!(NaiveTimerust-analyzer cargo chrono 0.4.45 naive/time/NaiveTime#, "partial-time"); |
| 93 | formatted_string_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/chrono04/formatted_string_impl!!(DateTime, "date-time", <Tz: TimeZonerust-analyzer cargo chrono 0.4.45 offset/TimeZone#> JsonSchemarust-analyzer cargo schemars 1.2.2 JsonSchema# for DateTimerust-analyzer cargo chrono 0.4.45 datetime/DateTime#<Tz>); |