Debian Codegraph @

src/json_schema_impls/tuple.rs

raw symbols SCIP
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 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#;
5
6 macro_rules! tuple_implsrust-analyzer cargo schemars 1.2.2 json_schema_impls/tuple/tuple_impls! {
7 ($($len:expr => ($($name:ident)+))+) => {
8 $(
9 impl<$($name: JsonSchema),+> JsonSchema for ($($name,)+) {
10 inline_schema!();
11
12 fn schema_name() -> Cow<'static, str> {
13 let mut name = "Tuple_of_".to_owned();
14 name.push_str(&[$($name::schema_name()),+].join("_and_"));
15 name.into()
16 }
17
18 fn schema_id() -> Cow<'static, str> {
19 let mut id = "(".to_owned();
20 id.push_str(&[$($name::schema_id()),+].join(","));
21 id.push(')');
22
23 id.into()
24 }
25
26 fn json_schema(generator: &mut SchemaGenerator) -> Schema {
27 json_schema!({
28 "type": "array",
29 "prefixItems": [
30 $(generator.subschema_for::<$name>()),+
31 ],
32 "minItems": $len,
33 "maxItems": $len,
34 })
35 }
36 }
37 )+
38 }
39 }
40
41 tuple_implsrust-analyzer cargo schemars 1.2.2 json_schema_impls/tuple/tuple_impls!! {
42 1 => (T0)
43 2 => (T0 T1)
44 3 => (T0 T1 T2)
45 4 => (T0 T1 T2 T3)
46 5 => (T0 T1 T2 T3 T4)
47 6 => (T0 T1 T2 T3 T4 T5)
48 7 => (T0 T1 T2 T3 T4 T5 T6)
49 8 => (T0 T1 T2 T3 T4 T5 T6 T7)
50 9 => (T0 T1 T2 T3 T4 T5 T6 T7 T8)
51 10 => (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9)
52 11 => (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10)
53 12 => (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11)
54 13 => (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12)
55 14 => (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13)
56 15 => (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14)
57 16 => (T0 T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15)
58 }