A better Rust ATProto crate
102
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 200 lines 7.3 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: test.ns1.defs 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8/// Another type in ns1 for cross-namespace ref testing. 9 10#[derive( 11 serde::Serialize, 12 serde::Deserialize, 13 Debug, 14 Clone, 15 PartialEq, 16 Eq, 17 jacquard_derive::IntoStatic, 18 Default 19)] 20 21#[serde( 22 rename_all = "camelCase", 23 bound(deserialize = "S: serde::Deserialize<'de> + jacquard_common::BosStr") 24)] 25pub struct Bar<S: jacquard_common::BosStr = jacquard_common::DefaultStr> { 26 pub tag: S, 27 #[serde(flatten, default, skip_serializing_if = "core::option::Option::is_none")] 28 pub extra_data: core::option::Option< 29 alloc::collections::BTreeMap< 30 jacquard_common::deps::smol_str::SmolStr, 31 jacquard_common::types::value::Data<S>, 32 >, 33 >, 34} 35 36/// A type defined in ns1, referenced cross-namespace by ns2. 37 38#[derive( 39 serde::Serialize, 40 serde::Deserialize, 41 Debug, 42 Clone, 43 PartialEq, 44 Eq, 45 jacquard_derive::IntoStatic, 46 Default 47)] 48 49#[serde( 50 rename_all = "camelCase", 51 bound(deserialize = "S: serde::Deserialize<'de> + jacquard_common::BosStr") 52)] 53pub struct Foo<S: jacquard_common::BosStr = jacquard_common::DefaultStr> { 54 pub name: S, 55 #[serde(skip_serializing_if = "core::option::Option::is_none")] 56 pub value: core::option::Option<i64>, 57 #[serde(flatten, default, skip_serializing_if = "core::option::Option::is_none")] 58 pub extra_data: core::option::Option< 59 alloc::collections::BTreeMap< 60 jacquard_common::deps::smol_str::SmolStr, 61 jacquard_common::types::value::Data<S>, 62 >, 63 >, 64} 65 66impl<S: jacquard_common::BosStr> jacquard_lexicon::schema::LexiconSchema for Bar<S> { 67 fn nsid() -> &'static str { 68 "test.ns1.defs" 69 } 70 fn def_name() -> &'static str { 71 "bar" 72 } 73 fn lexicon_doc() -> jacquard_lexicon::lexicon::LexiconDoc<'static> { 74 lexicon_doc_test_ns1_defs() 75 } 76 fn validate(&self) -> Result<(), jacquard_lexicon::validation::ConstraintError> { 77 { 78 let value = &self.tag; 79 #[allow(unused_comparisons)] 80 if <str>::len(value.as_ref()) > 50usize { 81 return Err(jacquard_lexicon::validation::ConstraintError::MaxLength { 82 path: jacquard_lexicon::validation::ValidationPath::from_field( 83 "tag", 84 ), 85 max: 50usize, 86 actual: <str>::len(value.as_ref()), 87 }); 88 } 89 } 90 Ok(()) 91 } 92} 93 94impl<S: jacquard_common::BosStr> jacquard_lexicon::schema::LexiconSchema for Foo<S> { 95 fn nsid() -> &'static str { 96 "test.ns1.defs" 97 } 98 fn def_name() -> &'static str { 99 "foo" 100 } 101 fn lexicon_doc() -> jacquard_lexicon::lexicon::LexiconDoc<'static> { 102 lexicon_doc_test_ns1_defs() 103 } 104 fn validate(&self) -> Result<(), jacquard_lexicon::validation::ConstraintError> { 105 { 106 let value = &self.name; 107 #[allow(unused_comparisons)] 108 if <str>::len(value.as_ref()) > 100usize { 109 return Err(jacquard_lexicon::validation::ConstraintError::MaxLength { 110 path: jacquard_lexicon::validation::ValidationPath::from_field( 111 "name", 112 ), 113 max: 100usize, 114 actual: <str>::len(value.as_ref()), 115 }); 116 } 117 } 118 Ok(()) 119 } 120} 121 122fn lexicon_doc_test_ns1_defs() -> jacquard_lexicon::lexicon::LexiconDoc<'static> { 123 ::jacquard_lexicon::lexicon::LexiconDoc { 124 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 125 id: ::jacquard_common::CowStr::new_static("test.ns1.defs"), 126 defs: { 127 let mut map = ::alloc::collections::BTreeMap::new(); 128 map.insert( 129 ::jacquard_common::deps::smol_str::SmolStr::new_static("bar"), 130 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 131 description: Some( 132 ::jacquard_common::CowStr::new_static( 133 "Another type in ns1 for cross-namespace ref testing.", 134 ), 135 ), 136 required: Some( 137 vec![ 138 ::jacquard_common::deps::smol_str::SmolStr::new_static("tag") 139 ], 140 ), 141 properties: { 142 #[allow(unused_mut)] 143 let mut map = ::alloc::collections::BTreeMap::new(); 144 map.insert( 145 ::jacquard_common::deps::smol_str::SmolStr::new_static( 146 "tag", 147 ), 148 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 149 max_length: Some(50usize), 150 ..Default::default() 151 }), 152 ); 153 map 154 }, 155 ..Default::default() 156 }), 157 ); 158 map.insert( 159 ::jacquard_common::deps::smol_str::SmolStr::new_static("foo"), 160 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 161 description: Some( 162 ::jacquard_common::CowStr::new_static( 163 "A type defined in ns1, referenced cross-namespace by ns2.", 164 ), 165 ), 166 required: Some( 167 vec![ 168 ::jacquard_common::deps::smol_str::SmolStr::new_static("name") 169 ], 170 ), 171 properties: { 172 #[allow(unused_mut)] 173 let mut map = ::alloc::collections::BTreeMap::new(); 174 map.insert( 175 ::jacquard_common::deps::smol_str::SmolStr::new_static( 176 "name", 177 ), 178 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 179 max_length: Some(100usize), 180 ..Default::default() 181 }), 182 ); 183 map.insert( 184 ::jacquard_common::deps::smol_str::SmolStr::new_static( 185 "value", 186 ), 187 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 188 ..Default::default() 189 }), 190 ); 191 map 192 }, 193 ..Default::default() 194 }), 195 ); 196 map 197 }, 198 ..Default::default() 199 } 200}