| 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/::_alloc_preluderust-analyzer cargo schemars 1.2.2 _alloc_prelude/::*; |
| 3 | 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#}; |
| 4 | use arrayvec07rust-analyzer cargo arrayvec 0.7.8 crate/::{ArrayStringrust-analyzer cargo arrayvec 0.7.8 array_string/ArrayString#, ArrayVecrust-analyzer cargo arrayvec 0.7.8 arrayvec/ArrayVec#}; |
| 5 | |
| 6 | // Do not set maxLength on the schema as that describes length in characters, but we only |
| 7 | // know max length in bytes. |
| 8 | forward_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/forward_impl!!((<const CAP: usize> JsonSchemarust-analyzer cargo schemars 1.2.2 JsonSchema# for ArrayStringrust-analyzer cargo arrayvec 0.7.8 array_string/ArrayString#<CAP>) => Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#); |
| 9 | |
| 10 | impl<T, const CAP: usize> JsonSchemarust-analyzer cargo schemars 1.2.2 JsonSchema# for ArrayVecrust-analyzer cargo arrayvec 0.7.8 arrayvec/ArrayVec#<T, CAP> |
| 11 | where |
| 12 | T: JsonSchemarust-analyzer cargo schemars 1.2.2 JsonSchema#, |
| 13 | { |
| 14 | inline_schemarust-analyzer cargo schemars 1.2.2 json_schema_impls/inline_schema!!(); |
| 15 | |
| 16 | fn schema_namerust-analyzer cargo schemars 1.2.2 json_schema_impls/arrayvec07/impl#[`ArrayVec<T, CAP>`][JsonSchema]schema_name().() -> 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#<'static, str> { |
| 17 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("Array_up_to_size_{}_of_{}", CAP, T::schema_namerust-analyzer cargo schemars 1.2.2 JsonSchema#schema_name().()).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 18 | } |
| 19 | |
| 20 | fn json_schemarust-analyzer cargo schemars 1.2.2 json_schema_impls/arrayvec07/impl#[`ArrayVec<T, CAP>`][JsonSchema]json_schema().(generator: &mut SchemaGeneratorrust-analyzer cargo schemars 1.2.2 generate/SchemaGenerator#) -> Schemarust-analyzer cargo schemars 1.2.2 schema/Schema# { |
| 21 | json_schemarust-analyzer cargo schemars 1.2.2 macros/json_schema!!({ |
| 22 | "type": "array", |
| 23 | "items": generator.subschema_forrust-analyzer cargo schemars 1.2.2 generate/impl#[SchemaGenerator]subschema_for().::<T>(), |
| 24 | "maxItems": CAP |
| 25 | }) |
| 26 | } |
| 27 | } |