Debian Codegraph @

src/json_schema_impls/nonzero.rs

raw symbols SCIP
1 use craterust-analyzer cargo schemars 1.2.2 crate/::_alloc_preluderust-analyzer cargo schemars 1.2.2 _alloc_prelude/::*;
2 use craterust-analyzer cargo schemars 1.2.2 crate/::{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#};
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 corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::numrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/::*;
5
6 macro_rules! nonzero_signed_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/nonzero/nonzero_signed_impl! {
7 ($type:ty => $primitive:ty) => {
8 impl JsonSchema for $type {
9 inline_schema!();
10
11 fn schema_name() -> Cow<'static, str> {
12 stringify!($type).into()
13 }
14
15 fn schema_id() -> Cow<'static, str> {
16 stringify!(std::num::$type).into()
17 }
18
19 fn json_schema(generator: &mut SchemaGenerator) -> Schema {
20 let mut schema = <$primitive>::json_schema(generator);
21 schema.insert("not".to_owned(), serde_json::json!({
22 "const": 0
23 }));
24 schema
25 }
26 }
27 };
28 }
29
30 nonzero_signed_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/nonzero/nonzero_signed_impl!!(NonZeroI8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroI8# => i8);
31 nonzero_signed_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/nonzero/nonzero_signed_impl!!(NonZeroI16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroI16# => i16);
32 nonzero_signed_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/nonzero/nonzero_signed_impl!!(NonZeroI32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroI32# => i32);
33 nonzero_signed_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/nonzero/nonzero_signed_impl!!(NonZeroI64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroI64# => i64);
34 nonzero_signed_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/nonzero/nonzero_signed_impl!!(NonZeroI128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroI128# => i128);
35 nonzero_signed_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/nonzero/nonzero_signed_impl!!(NonZeroIsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroIsize# => isize);
36
37 macro_rules! nonzero_unsigned_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/nonzero/nonzero_unsigned_impl! {
38 ($type:ty => $primitive:ty) => {
39 impl JsonSchema for $type {
40 inline_schema!();
41
42 fn schema_name() -> Cow<'static, str> {
43 stringify!($type).into()
44 }
45
46 fn schema_id() -> Cow<'static, str> {
47 stringify!(std::num::$type).into()
48 }
49
50 fn json_schema(generator: &mut SchemaGenerator) -> Schema {
51 let mut schema = <$primitive>::json_schema(generator);
52 schema.insert("minimum".to_owned(), 1.into());
53 schema
54 }
55 }
56 };
57 }
58
59 nonzero_unsigned_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/nonzero/nonzero_unsigned_impl!!(NonZeroU8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU8# => u8);
60 nonzero_unsigned_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/nonzero/nonzero_unsigned_impl!!(NonZeroU16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU16# => u16);
61 nonzero_unsigned_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/nonzero/nonzero_unsigned_impl!!(NonZeroU32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU32# => u32);
62 nonzero_unsigned_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/nonzero/nonzero_unsigned_impl!!(NonZeroU64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU64# => u64);
63 nonzero_unsigned_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/nonzero/nonzero_unsigned_impl!!(NonZeroU128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU128# => u128);
64 nonzero_unsigned_implrust-analyzer cargo schemars 1.2.2 json_schema_impls/nonzero/nonzero_unsigned_impl!!(NonZeroUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroUsize# => usize);