A better Rust ATProto crate
103
fork

Configure Feed

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

at main 2077 lines 77 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: com.atproto.label.defs 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8/// Metadata tag on an atproto resource (eg, repo or record). 9 10#[derive( 11 serde::Serialize, 12 serde::Deserialize, 13 Debug, 14 Clone, 15 PartialEq, 16 Eq, 17 jacquard_derive::IntoStatic 18)] 19 20#[serde( 21 rename_all = "camelCase", 22 bound(deserialize = "S: serde::Deserialize<'de> + jacquard_common::BosStr") 23)] 24pub struct Label<S: jacquard_common::BosStr = jacquard_common::DefaultStr> { 25 ///Optionally, CID specifying the specific version of 'uri' resource this label applies to. 26 #[serde(skip_serializing_if = "core::option::Option::is_none")] 27 pub cid: core::option::Option<jacquard_common::types::string::Cid<S>>, 28 ///Timestamp when this label was created. 29 pub cts: jacquard_common::types::string::Datetime, 30 ///Timestamp at which this label expires (no longer applies). 31 #[serde(skip_serializing_if = "core::option::Option::is_none")] 32 pub exp: core::option::Option<jacquard_common::types::string::Datetime>, 33 ///If true, this is a negation label, overwriting a previous label. 34 #[serde(skip_serializing_if = "core::option::Option::is_none")] 35 pub neg: core::option::Option<bool>, 36 ///Signature of dag-cbor encoded label. 37 #[serde(skip_serializing_if = "core::option::Option::is_none")] 38 #[serde(default, with = "jacquard_common::opt_serde_bytes_helper")] 39 pub sig: core::option::Option<jacquard_common::deps::bytes::Bytes>, 40 ///DID of the actor who created this label. 41 pub src: jacquard_common::types::string::Did<S>, 42 ///AT URI of the record, repository (account), or other resource that this label applies to. 43 pub uri: jacquard_common::types::string::UriValue<S>, 44 ///The short string name of the value or type of this label. 45 pub val: S, 46 ///The AT Protocol version of the label object. 47 #[serde(skip_serializing_if = "core::option::Option::is_none")] 48 pub ver: core::option::Option<i64>, 49 #[serde(flatten, default, skip_serializing_if = "core::option::Option::is_none")] 50 pub extra_data: core::option::Option< 51 alloc::collections::BTreeMap< 52 jacquard_common::deps::smol_str::SmolStr, 53 jacquard_common::types::value::Data<S>, 54 >, 55 >, 56} 57 58 59#[derive(Debug, Clone, PartialEq, Eq, Hash)] 60pub enum LabelValue<S: jacquard_common::BosStr = jacquard_common::DefaultStr> { 61 Hide, 62 NoPromote, 63 Warn, 64 NoUnauthenticated, 65 DmcaViolation, 66 Doxxing, 67 Porn, 68 Sexual, 69 Nudity, 70 Nsfl, 71 Gore, 72 Other(S), 73} 74 75impl<S: jacquard_common::BosStr> LabelValue<S> { 76 pub fn as_str(&self) -> &str { 77 match self { 78 Self::Hide => "!hide", 79 Self::NoPromote => "!no-promote", 80 Self::Warn => "!warn", 81 Self::NoUnauthenticated => "!no-unauthenticated", 82 Self::DmcaViolation => "dmca-violation", 83 Self::Doxxing => "doxxing", 84 Self::Porn => "porn", 85 Self::Sexual => "sexual", 86 Self::Nudity => "nudity", 87 Self::Nsfl => "nsfl", 88 Self::Gore => "gore", 89 Self::Other(s) => s.as_ref(), 90 } 91 } 92 /// Construct from a string-like value, matching known values. 93 pub fn from_value(s: S) -> Self { 94 match s.as_ref() { 95 "!hide" => Self::Hide, 96 "!no-promote" => Self::NoPromote, 97 "!warn" => Self::Warn, 98 "!no-unauthenticated" => Self::NoUnauthenticated, 99 "dmca-violation" => Self::DmcaViolation, 100 "doxxing" => Self::Doxxing, 101 "porn" => Self::Porn, 102 "sexual" => Self::Sexual, 103 "nudity" => Self::Nudity, 104 "nsfl" => Self::Nsfl, 105 "gore" => Self::Gore, 106 _ => Self::Other(s), 107 } 108 } 109} 110 111impl<S: jacquard_common::BosStr> AsRef<str> for LabelValue<S> { 112 fn as_ref(&self) -> &str { 113 self.as_str() 114 } 115} 116 117impl<S: jacquard_common::BosStr> core::fmt::Display for LabelValue<S> { 118 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 119 write!(f, "{}", self.as_str()) 120 } 121} 122 123impl<S: jacquard_common::BosStr> serde::Serialize for LabelValue<S> { 124 fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error> 125 where 126 Ser: serde::Serializer, 127 { 128 serializer.serialize_str(self.as_str()) 129 } 130} 131 132impl<'de, S: serde::Deserialize<'de> + jacquard_common::BosStr> serde::Deserialize<'de> 133for LabelValue<S> { 134 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> 135 where 136 D: serde::Deserializer<'de>, 137 { 138 let s = S::deserialize(deserializer)?; 139 Ok(Self::from_value(s)) 140 } 141} 142 143impl<S: jacquard_common::BosStr> jacquard_common::IntoStatic for LabelValue<S> 144where 145 S: jacquard_common::BosStr + jacquard_common::IntoStatic, 146 S::Output: jacquard_common::BosStr, 147{ 148 type Output = LabelValue<S::Output>; 149 fn into_static(self) -> Self::Output { 150 match self { 151 LabelValue::Hide => LabelValue::Hide, 152 LabelValue::NoPromote => LabelValue::NoPromote, 153 LabelValue::Warn => LabelValue::Warn, 154 LabelValue::NoUnauthenticated => LabelValue::NoUnauthenticated, 155 LabelValue::DmcaViolation => LabelValue::DmcaViolation, 156 LabelValue::Doxxing => LabelValue::Doxxing, 157 LabelValue::Porn => LabelValue::Porn, 158 LabelValue::Sexual => LabelValue::Sexual, 159 LabelValue::Nudity => LabelValue::Nudity, 160 LabelValue::Nsfl => LabelValue::Nsfl, 161 LabelValue::Gore => LabelValue::Gore, 162 LabelValue::Other(v) => LabelValue::Other(v.into_static()), 163 } 164 } 165} 166 167/// Declares a label value and its expected interpretations and behaviors. 168 169#[derive( 170 serde::Serialize, 171 serde::Deserialize, 172 Debug, 173 Clone, 174 PartialEq, 175 Eq, 176 jacquard_derive::IntoStatic 177)] 178 179#[serde( 180 rename_all = "camelCase", 181 bound(deserialize = "S: serde::Deserialize<'de> + jacquard_common::BosStr") 182)] 183pub struct LabelValueDefinition< 184 S: jacquard_common::BosStr = jacquard_common::DefaultStr, 185> { 186 ///Does the user need to have adult content enabled in order to configure this label? 187 #[serde(skip_serializing_if = "core::option::Option::is_none")] 188 pub adult_only: core::option::Option<bool>, 189 ///What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing. 190 pub blurs: LabelValueDefinitionBlurs<S>, 191 ///The default setting for this label. 192 #[serde(skip_serializing_if = "core::option::Option::is_none")] 193 pub default_setting: core::option::Option<LabelValueDefinitionDefaultSetting<S>>, 194 ///The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+). 195 pub identifier: S, 196 pub locales: Vec< 197 crate::macro_mode::com_atproto::label::LabelValueDefinitionStrings<S>, 198 >, 199 ///How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing. 200 pub severity: LabelValueDefinitionSeverity<S>, 201 #[serde(flatten, default, skip_serializing_if = "core::option::Option::is_none")] 202 pub extra_data: core::option::Option< 203 alloc::collections::BTreeMap< 204 jacquard_common::deps::smol_str::SmolStr, 205 jacquard_common::types::value::Data<S>, 206 >, 207 >, 208} 209 210/// What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing. 211 212#[derive(Debug, Clone, PartialEq, Eq, Hash)] 213pub enum LabelValueDefinitionBlurs< 214 S: jacquard_common::BosStr = jacquard_common::DefaultStr, 215> { 216 Content, 217 Media, 218 None, 219 Other(S), 220} 221 222impl<S: jacquard_common::BosStr> LabelValueDefinitionBlurs<S> { 223 pub fn as_str(&self) -> &str { 224 match self { 225 Self::Content => "content", 226 Self::Media => "media", 227 Self::None => "none", 228 Self::Other(s) => s.as_ref(), 229 } 230 } 231 /// Construct from a string-like value, matching known values. 232 pub fn from_value(s: S) -> Self { 233 match s.as_ref() { 234 "content" => Self::Content, 235 "media" => Self::Media, 236 "none" => Self::None, 237 _ => Self::Other(s), 238 } 239 } 240} 241 242impl<S: jacquard_common::BosStr> core::fmt::Display for LabelValueDefinitionBlurs<S> { 243 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 244 write!(f, "{}", self.as_str()) 245 } 246} 247 248impl<S: jacquard_common::BosStr> AsRef<str> for LabelValueDefinitionBlurs<S> { 249 fn as_ref(&self) -> &str { 250 self.as_str() 251 } 252} 253 254impl<S: jacquard_common::BosStr> serde::Serialize for LabelValueDefinitionBlurs<S> { 255 fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error> 256 where 257 Ser: serde::Serializer, 258 { 259 serializer.serialize_str(self.as_str()) 260 } 261} 262 263impl<'de, S: serde::Deserialize<'de> + jacquard_common::BosStr> serde::Deserialize<'de> 264for LabelValueDefinitionBlurs<S> { 265 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> 266 where 267 D: serde::Deserializer<'de>, 268 { 269 let s = S::deserialize(deserializer)?; 270 Ok(Self::from_value(s)) 271 } 272} 273 274impl<S: jacquard_common::BosStr + Default> Default for LabelValueDefinitionBlurs<S> { 275 fn default() -> Self { 276 Self::Other(Default::default()) 277 } 278} 279 280impl<S: jacquard_common::BosStr> jacquard_common::IntoStatic 281for LabelValueDefinitionBlurs<S> 282where 283 S: jacquard_common::BosStr + jacquard_common::IntoStatic, 284 S::Output: jacquard_common::BosStr, 285{ 286 type Output = LabelValueDefinitionBlurs<S::Output>; 287 fn into_static(self) -> Self::Output { 288 match self { 289 LabelValueDefinitionBlurs::Content => LabelValueDefinitionBlurs::Content, 290 LabelValueDefinitionBlurs::Media => LabelValueDefinitionBlurs::Media, 291 LabelValueDefinitionBlurs::None => LabelValueDefinitionBlurs::None, 292 LabelValueDefinitionBlurs::Other(v) => { 293 LabelValueDefinitionBlurs::Other(v.into_static()) 294 } 295 } 296 } 297} 298 299/// The default setting for this label. 300 301#[derive(Debug, Clone, PartialEq, Eq, Hash)] 302pub enum LabelValueDefinitionDefaultSetting< 303 S: jacquard_common::BosStr = jacquard_common::DefaultStr, 304> { 305 Ignore, 306 Warn, 307 Hide, 308 Other(S), 309} 310 311impl<S: jacquard_common::BosStr> LabelValueDefinitionDefaultSetting<S> { 312 pub fn as_str(&self) -> &str { 313 match self { 314 Self::Ignore => "ignore", 315 Self::Warn => "warn", 316 Self::Hide => "hide", 317 Self::Other(s) => s.as_ref(), 318 } 319 } 320 /// Construct from a string-like value, matching known values. 321 pub fn from_value(s: S) -> Self { 322 match s.as_ref() { 323 "ignore" => Self::Ignore, 324 "warn" => Self::Warn, 325 "hide" => Self::Hide, 326 _ => Self::Other(s), 327 } 328 } 329} 330 331impl<S: jacquard_common::BosStr> core::fmt::Display 332for LabelValueDefinitionDefaultSetting<S> { 333 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 334 write!(f, "{}", self.as_str()) 335 } 336} 337 338impl<S: jacquard_common::BosStr> AsRef<str> for LabelValueDefinitionDefaultSetting<S> { 339 fn as_ref(&self) -> &str { 340 self.as_str() 341 } 342} 343 344impl<S: jacquard_common::BosStr> serde::Serialize 345for LabelValueDefinitionDefaultSetting<S> { 346 fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error> 347 where 348 Ser: serde::Serializer, 349 { 350 serializer.serialize_str(self.as_str()) 351 } 352} 353 354impl<'de, S: serde::Deserialize<'de> + jacquard_common::BosStr> serde::Deserialize<'de> 355for LabelValueDefinitionDefaultSetting<S> { 356 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> 357 where 358 D: serde::Deserializer<'de>, 359 { 360 let s = S::deserialize(deserializer)?; 361 Ok(Self::from_value(s)) 362 } 363} 364 365impl<S: jacquard_common::BosStr + Default> Default 366for LabelValueDefinitionDefaultSetting<S> { 367 fn default() -> Self { 368 Self::Other(Default::default()) 369 } 370} 371 372impl<S: jacquard_common::BosStr> jacquard_common::IntoStatic 373for LabelValueDefinitionDefaultSetting<S> 374where 375 S: jacquard_common::BosStr + jacquard_common::IntoStatic, 376 S::Output: jacquard_common::BosStr, 377{ 378 type Output = LabelValueDefinitionDefaultSetting<S::Output>; 379 fn into_static(self) -> Self::Output { 380 match self { 381 LabelValueDefinitionDefaultSetting::Ignore => { 382 LabelValueDefinitionDefaultSetting::Ignore 383 } 384 LabelValueDefinitionDefaultSetting::Warn => { 385 LabelValueDefinitionDefaultSetting::Warn 386 } 387 LabelValueDefinitionDefaultSetting::Hide => { 388 LabelValueDefinitionDefaultSetting::Hide 389 } 390 LabelValueDefinitionDefaultSetting::Other(v) => { 391 LabelValueDefinitionDefaultSetting::Other(v.into_static()) 392 } 393 } 394 } 395} 396 397/// How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing. 398 399#[derive(Debug, Clone, PartialEq, Eq, Hash)] 400pub enum LabelValueDefinitionSeverity< 401 S: jacquard_common::BosStr = jacquard_common::DefaultStr, 402> { 403 Inform, 404 Alert, 405 None, 406 Other(S), 407} 408 409impl<S: jacquard_common::BosStr> LabelValueDefinitionSeverity<S> { 410 pub fn as_str(&self) -> &str { 411 match self { 412 Self::Inform => "inform", 413 Self::Alert => "alert", 414 Self::None => "none", 415 Self::Other(s) => s.as_ref(), 416 } 417 } 418 /// Construct from a string-like value, matching known values. 419 pub fn from_value(s: S) -> Self { 420 match s.as_ref() { 421 "inform" => Self::Inform, 422 "alert" => Self::Alert, 423 "none" => Self::None, 424 _ => Self::Other(s), 425 } 426 } 427} 428 429impl<S: jacquard_common::BosStr> core::fmt::Display for LabelValueDefinitionSeverity<S> { 430 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 431 write!(f, "{}", self.as_str()) 432 } 433} 434 435impl<S: jacquard_common::BosStr> AsRef<str> for LabelValueDefinitionSeverity<S> { 436 fn as_ref(&self) -> &str { 437 self.as_str() 438 } 439} 440 441impl<S: jacquard_common::BosStr> serde::Serialize for LabelValueDefinitionSeverity<S> { 442 fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error> 443 where 444 Ser: serde::Serializer, 445 { 446 serializer.serialize_str(self.as_str()) 447 } 448} 449 450impl<'de, S: serde::Deserialize<'de> + jacquard_common::BosStr> serde::Deserialize<'de> 451for LabelValueDefinitionSeverity<S> { 452 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> 453 where 454 D: serde::Deserializer<'de>, 455 { 456 let s = S::deserialize(deserializer)?; 457 Ok(Self::from_value(s)) 458 } 459} 460 461impl<S: jacquard_common::BosStr + Default> Default for LabelValueDefinitionSeverity<S> { 462 fn default() -> Self { 463 Self::Other(Default::default()) 464 } 465} 466 467impl<S: jacquard_common::BosStr> jacquard_common::IntoStatic 468for LabelValueDefinitionSeverity<S> 469where 470 S: jacquard_common::BosStr + jacquard_common::IntoStatic, 471 S::Output: jacquard_common::BosStr, 472{ 473 type Output = LabelValueDefinitionSeverity<S::Output>; 474 fn into_static(self) -> Self::Output { 475 match self { 476 LabelValueDefinitionSeverity::Inform => LabelValueDefinitionSeverity::Inform, 477 LabelValueDefinitionSeverity::Alert => LabelValueDefinitionSeverity::Alert, 478 LabelValueDefinitionSeverity::None => LabelValueDefinitionSeverity::None, 479 LabelValueDefinitionSeverity::Other(v) => { 480 LabelValueDefinitionSeverity::Other(v.into_static()) 481 } 482 } 483 } 484} 485 486/// Strings which describe the label in the UI, localized into a specific language. 487 488#[derive( 489 serde::Serialize, 490 serde::Deserialize, 491 Debug, 492 Clone, 493 PartialEq, 494 Eq, 495 jacquard_derive::IntoStatic 496)] 497 498#[serde( 499 rename_all = "camelCase", 500 bound(deserialize = "S: serde::Deserialize<'de> + jacquard_common::BosStr") 501)] 502pub struct LabelValueDefinitionStrings< 503 S: jacquard_common::BosStr = jacquard_common::DefaultStr, 504> { 505 ///A longer description of what the label means and why it might be applied. 506 pub description: S, 507 ///The code of the language these strings are written in. 508 pub lang: jacquard_common::types::string::Language, 509 ///A short human-readable name for the label. 510 pub name: S, 511 #[serde(flatten, default, skip_serializing_if = "core::option::Option::is_none")] 512 pub extra_data: core::option::Option< 513 alloc::collections::BTreeMap< 514 jacquard_common::deps::smol_str::SmolStr, 515 jacquard_common::types::value::Data<S>, 516 >, 517 >, 518} 519 520/// Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel. 521 522#[derive( 523 serde::Serialize, 524 serde::Deserialize, 525 Debug, 526 Clone, 527 PartialEq, 528 Eq, 529 jacquard_derive::IntoStatic, 530 Default 531)] 532 533#[serde( 534 rename_all = "camelCase", 535 bound(deserialize = "S: serde::Deserialize<'de> + jacquard_common::BosStr") 536)] 537pub struct SelfLabel<S: jacquard_common::BosStr = jacquard_common::DefaultStr> { 538 ///The short string name of the value or type of this label. 539 pub val: S, 540 #[serde(flatten, default, skip_serializing_if = "core::option::Option::is_none")] 541 pub extra_data: core::option::Option< 542 alloc::collections::BTreeMap< 543 jacquard_common::deps::smol_str::SmolStr, 544 jacquard_common::types::value::Data<S>, 545 >, 546 >, 547} 548 549/// Metadata tags on an atproto record, published by the author within the record. 550 551#[derive( 552 serde::Serialize, 553 serde::Deserialize, 554 Debug, 555 Clone, 556 PartialEq, 557 Eq, 558 jacquard_derive::IntoStatic 559)] 560 561#[serde( 562 rename_all = "camelCase", 563 bound(deserialize = "S: serde::Deserialize<'de> + jacquard_common::BosStr") 564)] 565pub struct SelfLabels<S: jacquard_common::BosStr = jacquard_common::DefaultStr> { 566 pub values: Vec<crate::macro_mode::com_atproto::label::SelfLabel<S>>, 567 #[serde(flatten, default, skip_serializing_if = "core::option::Option::is_none")] 568 pub extra_data: core::option::Option< 569 alloc::collections::BTreeMap< 570 jacquard_common::deps::smol_str::SmolStr, 571 jacquard_common::types::value::Data<S>, 572 >, 573 >, 574} 575 576impl<S: jacquard_common::BosStr> jacquard_lexicon::schema::LexiconSchema for Label<S> { 577 fn nsid() -> &'static str { 578 "com.atproto.label.defs" 579 } 580 fn def_name() -> &'static str { 581 "label" 582 } 583 fn lexicon_doc() -> jacquard_lexicon::lexicon::LexiconDoc<'static> { 584 lexicon_doc_com_atproto_label_defs() 585 } 586 fn validate(&self) -> Result<(), jacquard_lexicon::validation::ConstraintError> { 587 { 588 let value = &self.val; 589 #[allow(unused_comparisons)] 590 if <str>::len(value.as_ref()) > 128usize { 591 return Err(jacquard_lexicon::validation::ConstraintError::MaxLength { 592 path: jacquard_lexicon::validation::ValidationPath::from_field( 593 "val", 594 ), 595 max: 128usize, 596 actual: <str>::len(value.as_ref()), 597 }); 598 } 599 } 600 Ok(()) 601 } 602} 603 604impl<S: jacquard_common::BosStr> jacquard_lexicon::schema::LexiconSchema 605for LabelValueDefinition<S> { 606 fn nsid() -> &'static str { 607 "com.atproto.label.defs" 608 } 609 fn def_name() -> &'static str { 610 "labelValueDefinition" 611 } 612 fn lexicon_doc() -> jacquard_lexicon::lexicon::LexiconDoc<'static> { 613 lexicon_doc_com_atproto_label_defs() 614 } 615 fn validate(&self) -> Result<(), jacquard_lexicon::validation::ConstraintError> { 616 { 617 let value = &self.identifier; 618 #[allow(unused_comparisons)] 619 if <str>::len(value.as_ref()) > 100usize { 620 return Err(jacquard_lexicon::validation::ConstraintError::MaxLength { 621 path: jacquard_lexicon::validation::ValidationPath::from_field( 622 "identifier", 623 ), 624 max: 100usize, 625 actual: <str>::len(value.as_ref()), 626 }); 627 } 628 } 629 { 630 let value = &self.identifier; 631 { 632 let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes( 633 value.as_ref(), 634 true, 635 ) 636 .count(); 637 if count > 100usize { 638 return Err(jacquard_lexicon::validation::ConstraintError::MaxGraphemes { 639 path: jacquard_lexicon::validation::ValidationPath::from_field( 640 "identifier", 641 ), 642 max: 100usize, 643 actual: count, 644 }); 645 } 646 } 647 } 648 Ok(()) 649 } 650} 651 652impl<S: jacquard_common::BosStr> jacquard_lexicon::schema::LexiconSchema 653for LabelValueDefinitionStrings<S> { 654 fn nsid() -> &'static str { 655 "com.atproto.label.defs" 656 } 657 fn def_name() -> &'static str { 658 "labelValueDefinitionStrings" 659 } 660 fn lexicon_doc() -> jacquard_lexicon::lexicon::LexiconDoc<'static> { 661 lexicon_doc_com_atproto_label_defs() 662 } 663 fn validate(&self) -> Result<(), jacquard_lexicon::validation::ConstraintError> { 664 { 665 let value = &self.description; 666 #[allow(unused_comparisons)] 667 if <str>::len(value.as_ref()) > 100000usize { 668 return Err(jacquard_lexicon::validation::ConstraintError::MaxLength { 669 path: jacquard_lexicon::validation::ValidationPath::from_field( 670 "description", 671 ), 672 max: 100000usize, 673 actual: <str>::len(value.as_ref()), 674 }); 675 } 676 } 677 { 678 let value = &self.description; 679 { 680 let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes( 681 value.as_ref(), 682 true, 683 ) 684 .count(); 685 if count > 10000usize { 686 return Err(jacquard_lexicon::validation::ConstraintError::MaxGraphemes { 687 path: jacquard_lexicon::validation::ValidationPath::from_field( 688 "description", 689 ), 690 max: 10000usize, 691 actual: count, 692 }); 693 } 694 } 695 } 696 { 697 let value = &self.name; 698 #[allow(unused_comparisons)] 699 if <str>::len(value.as_ref()) > 640usize { 700 return Err(jacquard_lexicon::validation::ConstraintError::MaxLength { 701 path: jacquard_lexicon::validation::ValidationPath::from_field( 702 "name", 703 ), 704 max: 640usize, 705 actual: <str>::len(value.as_ref()), 706 }); 707 } 708 } 709 { 710 let value = &self.name; 711 { 712 let count = jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation::graphemes( 713 value.as_ref(), 714 true, 715 ) 716 .count(); 717 if count > 64usize { 718 return Err(jacquard_lexicon::validation::ConstraintError::MaxGraphemes { 719 path: jacquard_lexicon::validation::ValidationPath::from_field( 720 "name", 721 ), 722 max: 64usize, 723 actual: count, 724 }); 725 } 726 } 727 } 728 Ok(()) 729 } 730} 731 732impl<S: jacquard_common::BosStr> jacquard_lexicon::schema::LexiconSchema 733for SelfLabel<S> { 734 fn nsid() -> &'static str { 735 "com.atproto.label.defs" 736 } 737 fn def_name() -> &'static str { 738 "selfLabel" 739 } 740 fn lexicon_doc() -> jacquard_lexicon::lexicon::LexiconDoc<'static> { 741 lexicon_doc_com_atproto_label_defs() 742 } 743 fn validate(&self) -> Result<(), jacquard_lexicon::validation::ConstraintError> { 744 { 745 let value = &self.val; 746 #[allow(unused_comparisons)] 747 if <str>::len(value.as_ref()) > 128usize { 748 return Err(jacquard_lexicon::validation::ConstraintError::MaxLength { 749 path: jacquard_lexicon::validation::ValidationPath::from_field( 750 "val", 751 ), 752 max: 128usize, 753 actual: <str>::len(value.as_ref()), 754 }); 755 } 756 } 757 Ok(()) 758 } 759} 760 761impl<S: jacquard_common::BosStr> jacquard_lexicon::schema::LexiconSchema 762for SelfLabels<S> { 763 fn nsid() -> &'static str { 764 "com.atproto.label.defs" 765 } 766 fn def_name() -> &'static str { 767 "selfLabels" 768 } 769 fn lexicon_doc() -> jacquard_lexicon::lexicon::LexiconDoc<'static> { 770 lexicon_doc_com_atproto_label_defs() 771 } 772 fn validate(&self) -> Result<(), jacquard_lexicon::validation::ConstraintError> { 773 { 774 let value = &self.values; 775 #[allow(unused_comparisons)] 776 if value.len() > 10usize { 777 return Err(jacquard_lexicon::validation::ConstraintError::MaxLength { 778 path: jacquard_lexicon::validation::ValidationPath::from_field( 779 "values", 780 ), 781 max: 10usize, 782 actual: value.len(), 783 }); 784 } 785 } 786 Ok(()) 787 } 788} 789 790pub mod label_state { 791 792 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 793 #[allow(unused)] 794 use ::core::marker::PhantomData; 795 mod sealed { 796 pub trait Sealed {} 797 } 798 /// State trait tracking which required fields have been set 799 pub trait State: sealed::Sealed { 800 type Val; 801 type Cts; 802 type Uri; 803 type Src; 804 } 805 /// Empty state - all required fields are unset 806 pub struct Empty(()); 807 impl sealed::Sealed for Empty {} 808 impl State for Empty { 809 type Val = Unset; 810 type Cts = Unset; 811 type Uri = Unset; 812 type Src = Unset; 813 } 814 ///State transition - sets the `val` field to Set 815 pub struct SetVal<St: State = Empty>(PhantomData<fn() -> St>); 816 impl<St: State> sealed::Sealed for SetVal<St> {} 817 impl<St: State> State for SetVal<St> { 818 type Val = Set<members::val>; 819 type Cts = St::Cts; 820 type Uri = St::Uri; 821 type Src = St::Src; 822 } 823 ///State transition - sets the `cts` field to Set 824 pub struct SetCts<St: State = Empty>(PhantomData<fn() -> St>); 825 impl<St: State> sealed::Sealed for SetCts<St> {} 826 impl<St: State> State for SetCts<St> { 827 type Val = St::Val; 828 type Cts = Set<members::cts>; 829 type Uri = St::Uri; 830 type Src = St::Src; 831 } 832 ///State transition - sets the `uri` field to Set 833 pub struct SetUri<St: State = Empty>(PhantomData<fn() -> St>); 834 impl<St: State> sealed::Sealed for SetUri<St> {} 835 impl<St: State> State for SetUri<St> { 836 type Val = St::Val; 837 type Cts = St::Cts; 838 type Uri = Set<members::uri>; 839 type Src = St::Src; 840 } 841 ///State transition - sets the `src` field to Set 842 pub struct SetSrc<St: State = Empty>(PhantomData<fn() -> St>); 843 impl<St: State> sealed::Sealed for SetSrc<St> {} 844 impl<St: State> State for SetSrc<St> { 845 type Val = St::Val; 846 type Cts = St::Cts; 847 type Uri = St::Uri; 848 type Src = Set<members::src>; 849 } 850 /// Marker types for field names 851 #[allow(non_camel_case_types)] 852 pub mod members { 853 ///Marker type for the `val` field 854 pub struct val(()); 855 ///Marker type for the `cts` field 856 pub struct cts(()); 857 ///Marker type for the `uri` field 858 pub struct uri(()); 859 ///Marker type for the `src` field 860 pub struct src(()); 861 } 862} 863 864/// Builder for constructing an instance of this type. 865pub struct LabelBuilder<S: jacquard_common::BosStr, St: label_state::State> { 866 _state: ::core::marker::PhantomData<fn() -> St>, 867 _fields: ( 868 core::option::Option<jacquard_common::types::string::Cid<S>>, 869 core::option::Option<jacquard_common::types::string::Datetime>, 870 core::option::Option<jacquard_common::types::string::Datetime>, 871 core::option::Option<bool>, 872 core::option::Option<jacquard_common::deps::bytes::Bytes>, 873 core::option::Option<jacquard_common::types::string::Did<S>>, 874 core::option::Option<jacquard_common::types::string::UriValue<S>>, 875 core::option::Option<S>, 876 core::option::Option<i64>, 877 ), 878 _type: ::core::marker::PhantomData<fn() -> S>, 879} 880 881impl<S: jacquard_common::BosStr> Label<S> { 882 /// Create a new builder for this type. 883 pub fn new() -> LabelBuilder<S, label_state::Empty> { 884 LabelBuilder::new() 885 } 886} 887 888impl<S: jacquard_common::BosStr> LabelBuilder<S, label_state::Empty> { 889 /// Create a new builder with all fields unset. 890 pub fn new() -> Self { 891 LabelBuilder { 892 _state: ::core::marker::PhantomData, 893 _fields: (None, None, None, None, None, None, None, None, None), 894 _type: ::core::marker::PhantomData, 895 } 896 } 897} 898 899impl<S: jacquard_common::BosStr, St: label_state::State> LabelBuilder<S, St> { 900 /// Set the `cid` field (optional) 901 pub fn cid( 902 mut self, 903 value: impl Into<Option<jacquard_common::types::string::Cid<S>>>, 904 ) -> Self { 905 self._fields.0 = value.into(); 906 self 907 } 908 /// Set the `cid` field to an Option value (optional) 909 pub fn maybe_cid( 910 mut self, 911 value: Option<jacquard_common::types::string::Cid<S>>, 912 ) -> Self { 913 self._fields.0 = value; 914 self 915 } 916} 917 918impl<S: jacquard_common::BosStr, St> LabelBuilder<S, St> 919where 920 St: label_state::State, 921 St::Cts: label_state::IsUnset, 922{ 923 /// Set the `cts` field (required) 924 pub fn cts( 925 mut self, 926 value: impl Into<jacquard_common::types::string::Datetime>, 927 ) -> LabelBuilder<S, label_state::SetCts<St>> { 928 self._fields.1 = ::core::option::Option::Some(value.into()); 929 LabelBuilder { 930 _state: ::core::marker::PhantomData, 931 _fields: self._fields, 932 _type: ::core::marker::PhantomData, 933 } 934 } 935} 936 937impl<S: jacquard_common::BosStr, St: label_state::State> LabelBuilder<S, St> { 938 /// Set the `exp` field (optional) 939 pub fn exp( 940 mut self, 941 value: impl Into<Option<jacquard_common::types::string::Datetime>>, 942 ) -> Self { 943 self._fields.2 = value.into(); 944 self 945 } 946 /// Set the `exp` field to an Option value (optional) 947 pub fn maybe_exp( 948 mut self, 949 value: Option<jacquard_common::types::string::Datetime>, 950 ) -> Self { 951 self._fields.2 = value; 952 self 953 } 954} 955 956impl<S: jacquard_common::BosStr, St: label_state::State> LabelBuilder<S, St> { 957 /// Set the `neg` field (optional) 958 pub fn neg(mut self, value: impl Into<Option<bool>>) -> Self { 959 self._fields.3 = value.into(); 960 self 961 } 962 /// Set the `neg` field to an Option value (optional) 963 pub fn maybe_neg(mut self, value: Option<bool>) -> Self { 964 self._fields.3 = value; 965 self 966 } 967} 968 969impl<S: jacquard_common::BosStr, St: label_state::State> LabelBuilder<S, St> { 970 /// Set the `sig` field (optional) 971 pub fn sig( 972 mut self, 973 value: impl Into<Option<jacquard_common::deps::bytes::Bytes>>, 974 ) -> Self { 975 self._fields.4 = value.into(); 976 self 977 } 978 /// Set the `sig` field to an Option value (optional) 979 pub fn maybe_sig( 980 mut self, 981 value: Option<jacquard_common::deps::bytes::Bytes>, 982 ) -> Self { 983 self._fields.4 = value; 984 self 985 } 986} 987 988impl<S: jacquard_common::BosStr, St> LabelBuilder<S, St> 989where 990 St: label_state::State, 991 St::Src: label_state::IsUnset, 992{ 993 /// Set the `src` field (required) 994 pub fn src( 995 mut self, 996 value: impl Into<jacquard_common::types::string::Did<S>>, 997 ) -> LabelBuilder<S, label_state::SetSrc<St>> { 998 self._fields.5 = ::core::option::Option::Some(value.into()); 999 LabelBuilder { 1000 _state: ::core::marker::PhantomData, 1001 _fields: self._fields, 1002 _type: ::core::marker::PhantomData, 1003 } 1004 } 1005} 1006 1007impl<S: jacquard_common::BosStr, St> LabelBuilder<S, St> 1008where 1009 St: label_state::State, 1010 St::Uri: label_state::IsUnset, 1011{ 1012 /// Set the `uri` field (required) 1013 pub fn uri( 1014 mut self, 1015 value: impl Into<jacquard_common::types::string::UriValue<S>>, 1016 ) -> LabelBuilder<S, label_state::SetUri<St>> { 1017 self._fields.6 = ::core::option::Option::Some(value.into()); 1018 LabelBuilder { 1019 _state: ::core::marker::PhantomData, 1020 _fields: self._fields, 1021 _type: ::core::marker::PhantomData, 1022 } 1023 } 1024} 1025 1026impl<S: jacquard_common::BosStr, St> LabelBuilder<S, St> 1027where 1028 St: label_state::State, 1029 St::Val: label_state::IsUnset, 1030{ 1031 /// Set the `val` field (required) 1032 pub fn val( 1033 mut self, 1034 value: impl Into<S>, 1035 ) -> LabelBuilder<S, label_state::SetVal<St>> { 1036 self._fields.7 = ::core::option::Option::Some(value.into()); 1037 LabelBuilder { 1038 _state: ::core::marker::PhantomData, 1039 _fields: self._fields, 1040 _type: ::core::marker::PhantomData, 1041 } 1042 } 1043} 1044 1045impl<S: jacquard_common::BosStr, St: label_state::State> LabelBuilder<S, St> { 1046 /// Set the `ver` field (optional) 1047 pub fn ver(mut self, value: impl Into<Option<i64>>) -> Self { 1048 self._fields.8 = value.into(); 1049 self 1050 } 1051 /// Set the `ver` field to an Option value (optional) 1052 pub fn maybe_ver(mut self, value: Option<i64>) -> Self { 1053 self._fields.8 = value; 1054 self 1055 } 1056} 1057 1058impl<S: jacquard_common::BosStr, St> LabelBuilder<S, St> 1059where 1060 St: label_state::State, 1061 St::Val: label_state::IsSet, 1062 St::Cts: label_state::IsSet, 1063 St::Uri: label_state::IsSet, 1064 St::Src: label_state::IsSet, 1065{ 1066 /// Build the final struct. 1067 pub fn build(self) -> Label<S> { 1068 Label { 1069 cid: self._fields.0, 1070 cts: self._fields.1.unwrap(), 1071 exp: self._fields.2, 1072 neg: self._fields.3, 1073 sig: self._fields.4, 1074 src: self._fields.5.unwrap(), 1075 uri: self._fields.6.unwrap(), 1076 val: self._fields.7.unwrap(), 1077 ver: self._fields.8, 1078 extra_data: Default::default(), 1079 } 1080 } 1081 /// Build the final struct with custom extra_data. 1082 pub fn build_with_data( 1083 self, 1084 extra_data: alloc::collections::BTreeMap< 1085 jacquard_common::deps::smol_str::SmolStr, 1086 jacquard_common::types::value::Data<S>, 1087 >, 1088 ) -> Label<S> { 1089 Label { 1090 cid: self._fields.0, 1091 cts: self._fields.1.unwrap(), 1092 exp: self._fields.2, 1093 neg: self._fields.3, 1094 sig: self._fields.4, 1095 src: self._fields.5.unwrap(), 1096 uri: self._fields.6.unwrap(), 1097 val: self._fields.7.unwrap(), 1098 ver: self._fields.8, 1099 extra_data: Some(extra_data), 1100 } 1101 } 1102} 1103 1104fn lexicon_doc_com_atproto_label_defs() -> jacquard_lexicon::lexicon::LexiconDoc< 1105 'static, 1106> { 1107 ::jacquard_lexicon::lexicon::LexiconDoc { 1108 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 1109 id: ::jacquard_common::CowStr::new_static("com.atproto.label.defs"), 1110 defs: { 1111 let mut map = ::alloc::collections::BTreeMap::new(); 1112 map.insert( 1113 ::jacquard_common::deps::smol_str::SmolStr::new_static("label"), 1114 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 1115 description: Some( 1116 ::jacquard_common::CowStr::new_static( 1117 "Metadata tag on an atproto resource (eg, repo or record).", 1118 ), 1119 ), 1120 required: Some( 1121 vec![ 1122 ::jacquard_common::deps::smol_str::SmolStr::new_static("src"), 1123 ::jacquard_common::deps::smol_str::SmolStr::new_static("uri"), 1124 ::jacquard_common::deps::smol_str::SmolStr::new_static("val"), 1125 ::jacquard_common::deps::smol_str::SmolStr::new_static("cts") 1126 ], 1127 ), 1128 properties: { 1129 #[allow(unused_mut)] 1130 let mut map = ::alloc::collections::BTreeMap::new(); 1131 map.insert( 1132 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1133 "cid", 1134 ), 1135 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 1136 description: Some( 1137 ::jacquard_common::CowStr::new_static( 1138 "Optionally, CID specifying the specific version of 'uri' resource this label applies to.", 1139 ), 1140 ), 1141 format: Some( 1142 ::jacquard_lexicon::lexicon::LexStringFormat::Cid, 1143 ), 1144 ..Default::default() 1145 }), 1146 ); 1147 map.insert( 1148 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1149 "cts", 1150 ), 1151 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 1152 description: Some( 1153 ::jacquard_common::CowStr::new_static( 1154 "Timestamp when this label was created.", 1155 ), 1156 ), 1157 format: Some( 1158 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, 1159 ), 1160 ..Default::default() 1161 }), 1162 ); 1163 map.insert( 1164 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1165 "exp", 1166 ), 1167 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 1168 description: Some( 1169 ::jacquard_common::CowStr::new_static( 1170 "Timestamp at which this label expires (no longer applies).", 1171 ), 1172 ), 1173 format: Some( 1174 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, 1175 ), 1176 ..Default::default() 1177 }), 1178 ); 1179 map.insert( 1180 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1181 "neg", 1182 ), 1183 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { 1184 ..Default::default() 1185 }), 1186 ); 1187 map.insert( 1188 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1189 "sig", 1190 ), 1191 ::jacquard_lexicon::lexicon::LexObjectProperty::Bytes(::jacquard_lexicon::lexicon::LexBytes { 1192 ..Default::default() 1193 }), 1194 ); 1195 map.insert( 1196 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1197 "src", 1198 ), 1199 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 1200 description: Some( 1201 ::jacquard_common::CowStr::new_static( 1202 "DID of the actor who created this label.", 1203 ), 1204 ), 1205 format: Some( 1206 ::jacquard_lexicon::lexicon::LexStringFormat::Did, 1207 ), 1208 ..Default::default() 1209 }), 1210 ); 1211 map.insert( 1212 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1213 "uri", 1214 ), 1215 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 1216 description: Some( 1217 ::jacquard_common::CowStr::new_static( 1218 "AT URI of the record, repository (account), or other resource that this label applies to.", 1219 ), 1220 ), 1221 format: Some( 1222 ::jacquard_lexicon::lexicon::LexStringFormat::Uri, 1223 ), 1224 ..Default::default() 1225 }), 1226 ); 1227 map.insert( 1228 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1229 "val", 1230 ), 1231 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 1232 description: Some( 1233 ::jacquard_common::CowStr::new_static( 1234 "The short string name of the value or type of this label.", 1235 ), 1236 ), 1237 max_length: Some(128usize), 1238 ..Default::default() 1239 }), 1240 ); 1241 map.insert( 1242 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1243 "ver", 1244 ), 1245 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 1246 ..Default::default() 1247 }), 1248 ); 1249 map 1250 }, 1251 ..Default::default() 1252 }), 1253 ); 1254 map.insert( 1255 ::jacquard_common::deps::smol_str::SmolStr::new_static("labelValue"), 1256 ::jacquard_lexicon::lexicon::LexUserType::String(::jacquard_lexicon::lexicon::LexString { 1257 ..Default::default() 1258 }), 1259 ); 1260 map.insert( 1261 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1262 "labelValueDefinition", 1263 ), 1264 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 1265 description: Some( 1266 ::jacquard_common::CowStr::new_static( 1267 "Declares a label value and its expected interpretations and behaviors.", 1268 ), 1269 ), 1270 required: Some( 1271 vec![ 1272 ::jacquard_common::deps::smol_str::SmolStr::new_static("identifier"), 1273 ::jacquard_common::deps::smol_str::SmolStr::new_static("severity"), 1274 ::jacquard_common::deps::smol_str::SmolStr::new_static("blurs"), 1275 ::jacquard_common::deps::smol_str::SmolStr::new_static("locales") 1276 ], 1277 ), 1278 properties: { 1279 #[allow(unused_mut)] 1280 let mut map = ::alloc::collections::BTreeMap::new(); 1281 map.insert( 1282 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1283 "adultOnly", 1284 ), 1285 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { 1286 ..Default::default() 1287 }), 1288 ); 1289 map.insert( 1290 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1291 "blurs", 1292 ), 1293 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 1294 description: Some( 1295 ::jacquard_common::CowStr::new_static( 1296 "What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing.", 1297 ), 1298 ), 1299 ..Default::default() 1300 }), 1301 ); 1302 map.insert( 1303 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1304 "defaultSetting", 1305 ), 1306 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 1307 description: Some( 1308 ::jacquard_common::CowStr::new_static( 1309 "The default setting for this label.", 1310 ), 1311 ), 1312 ..Default::default() 1313 }), 1314 ); 1315 map.insert( 1316 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1317 "identifier", 1318 ), 1319 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 1320 description: Some( 1321 ::jacquard_common::CowStr::new_static( 1322 "The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+).", 1323 ), 1324 ), 1325 max_length: Some(100usize), 1326 max_graphemes: Some(100usize), 1327 ..Default::default() 1328 }), 1329 ); 1330 map.insert( 1331 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1332 "locales", 1333 ), 1334 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 1335 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { 1336 r#ref: ::jacquard_common::CowStr::new_static( 1337 "#labelValueDefinitionStrings", 1338 ), 1339 ..Default::default() 1340 }), 1341 ..Default::default() 1342 }), 1343 ); 1344 map.insert( 1345 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1346 "severity", 1347 ), 1348 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 1349 description: Some( 1350 ::jacquard_common::CowStr::new_static( 1351 "How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing.", 1352 ), 1353 ), 1354 ..Default::default() 1355 }), 1356 ); 1357 map 1358 }, 1359 ..Default::default() 1360 }), 1361 ); 1362 map.insert( 1363 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1364 "labelValueDefinitionStrings", 1365 ), 1366 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 1367 description: Some( 1368 ::jacquard_common::CowStr::new_static( 1369 "Strings which describe the label in the UI, localized into a specific language.", 1370 ), 1371 ), 1372 required: Some( 1373 vec![ 1374 ::jacquard_common::deps::smol_str::SmolStr::new_static("lang"), 1375 ::jacquard_common::deps::smol_str::SmolStr::new_static("name"), 1376 ::jacquard_common::deps::smol_str::SmolStr::new_static("description") 1377 ], 1378 ), 1379 properties: { 1380 #[allow(unused_mut)] 1381 let mut map = ::alloc::collections::BTreeMap::new(); 1382 map.insert( 1383 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1384 "description", 1385 ), 1386 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 1387 description: Some( 1388 ::jacquard_common::CowStr::new_static( 1389 "A longer description of what the label means and why it might be applied.", 1390 ), 1391 ), 1392 max_length: Some(100000usize), 1393 max_graphemes: Some(10000usize), 1394 ..Default::default() 1395 }), 1396 ); 1397 map.insert( 1398 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1399 "lang", 1400 ), 1401 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 1402 description: Some( 1403 ::jacquard_common::CowStr::new_static( 1404 "The code of the language these strings are written in.", 1405 ), 1406 ), 1407 format: Some( 1408 ::jacquard_lexicon::lexicon::LexStringFormat::Language, 1409 ), 1410 ..Default::default() 1411 }), 1412 ); 1413 map.insert( 1414 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1415 "name", 1416 ), 1417 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 1418 description: Some( 1419 ::jacquard_common::CowStr::new_static( 1420 "A short human-readable name for the label.", 1421 ), 1422 ), 1423 max_length: Some(640usize), 1424 max_graphemes: Some(64usize), 1425 ..Default::default() 1426 }), 1427 ); 1428 map 1429 }, 1430 ..Default::default() 1431 }), 1432 ); 1433 map.insert( 1434 ::jacquard_common::deps::smol_str::SmolStr::new_static("selfLabel"), 1435 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 1436 description: Some( 1437 ::jacquard_common::CowStr::new_static( 1438 "Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel.", 1439 ), 1440 ), 1441 required: Some( 1442 vec![ 1443 ::jacquard_common::deps::smol_str::SmolStr::new_static("val") 1444 ], 1445 ), 1446 properties: { 1447 #[allow(unused_mut)] 1448 let mut map = ::alloc::collections::BTreeMap::new(); 1449 map.insert( 1450 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1451 "val", 1452 ), 1453 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 1454 description: Some( 1455 ::jacquard_common::CowStr::new_static( 1456 "The short string name of the value or type of this label.", 1457 ), 1458 ), 1459 max_length: Some(128usize), 1460 ..Default::default() 1461 }), 1462 ); 1463 map 1464 }, 1465 ..Default::default() 1466 }), 1467 ); 1468 map.insert( 1469 ::jacquard_common::deps::smol_str::SmolStr::new_static("selfLabels"), 1470 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 1471 description: Some( 1472 ::jacquard_common::CowStr::new_static( 1473 "Metadata tags on an atproto record, published by the author within the record.", 1474 ), 1475 ), 1476 required: Some( 1477 vec![ 1478 ::jacquard_common::deps::smol_str::SmolStr::new_static("values") 1479 ], 1480 ), 1481 properties: { 1482 #[allow(unused_mut)] 1483 let mut map = ::alloc::collections::BTreeMap::new(); 1484 map.insert( 1485 ::jacquard_common::deps::smol_str::SmolStr::new_static( 1486 "values", 1487 ), 1488 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 1489 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { 1490 r#ref: ::jacquard_common::CowStr::new_static("#selfLabel"), 1491 ..Default::default() 1492 }), 1493 max_length: Some(10usize), 1494 ..Default::default() 1495 }), 1496 ); 1497 map 1498 }, 1499 ..Default::default() 1500 }), 1501 ); 1502 map 1503 }, 1504 ..Default::default() 1505 } 1506} 1507 1508pub mod label_value_definition_state { 1509 1510 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 1511 #[allow(unused)] 1512 use ::core::marker::PhantomData; 1513 mod sealed { 1514 pub trait Sealed {} 1515 } 1516 /// State trait tracking which required fields have been set 1517 pub trait State: sealed::Sealed { 1518 type Identifier; 1519 type Blurs; 1520 type Locales; 1521 type Severity; 1522 } 1523 /// Empty state - all required fields are unset 1524 pub struct Empty(()); 1525 impl sealed::Sealed for Empty {} 1526 impl State for Empty { 1527 type Identifier = Unset; 1528 type Blurs = Unset; 1529 type Locales = Unset; 1530 type Severity = Unset; 1531 } 1532 ///State transition - sets the `identifier` field to Set 1533 pub struct SetIdentifier<St: State = Empty>(PhantomData<fn() -> St>); 1534 impl<St: State> sealed::Sealed for SetIdentifier<St> {} 1535 impl<St: State> State for SetIdentifier<St> { 1536 type Identifier = Set<members::identifier>; 1537 type Blurs = St::Blurs; 1538 type Locales = St::Locales; 1539 type Severity = St::Severity; 1540 } 1541 ///State transition - sets the `blurs` field to Set 1542 pub struct SetBlurs<St: State = Empty>(PhantomData<fn() -> St>); 1543 impl<St: State> sealed::Sealed for SetBlurs<St> {} 1544 impl<St: State> State for SetBlurs<St> { 1545 type Identifier = St::Identifier; 1546 type Blurs = Set<members::blurs>; 1547 type Locales = St::Locales; 1548 type Severity = St::Severity; 1549 } 1550 ///State transition - sets the `locales` field to Set 1551 pub struct SetLocales<St: State = Empty>(PhantomData<fn() -> St>); 1552 impl<St: State> sealed::Sealed for SetLocales<St> {} 1553 impl<St: State> State for SetLocales<St> { 1554 type Identifier = St::Identifier; 1555 type Blurs = St::Blurs; 1556 type Locales = Set<members::locales>; 1557 type Severity = St::Severity; 1558 } 1559 ///State transition - sets the `severity` field to Set 1560 pub struct SetSeverity<St: State = Empty>(PhantomData<fn() -> St>); 1561 impl<St: State> sealed::Sealed for SetSeverity<St> {} 1562 impl<St: State> State for SetSeverity<St> { 1563 type Identifier = St::Identifier; 1564 type Blurs = St::Blurs; 1565 type Locales = St::Locales; 1566 type Severity = Set<members::severity>; 1567 } 1568 /// Marker types for field names 1569 #[allow(non_camel_case_types)] 1570 pub mod members { 1571 ///Marker type for the `identifier` field 1572 pub struct identifier(()); 1573 ///Marker type for the `blurs` field 1574 pub struct blurs(()); 1575 ///Marker type for the `locales` field 1576 pub struct locales(()); 1577 ///Marker type for the `severity` field 1578 pub struct severity(()); 1579 } 1580} 1581 1582/// Builder for constructing an instance of this type. 1583pub struct LabelValueDefinitionBuilder< 1584 S: jacquard_common::BosStr, 1585 St: label_value_definition_state::State, 1586> { 1587 _state: ::core::marker::PhantomData<fn() -> St>, 1588 _fields: ( 1589 core::option::Option<bool>, 1590 core::option::Option<LabelValueDefinitionBlurs<S>>, 1591 core::option::Option<LabelValueDefinitionDefaultSetting<S>>, 1592 core::option::Option<S>, 1593 core::option::Option< 1594 Vec<crate::macro_mode::com_atproto::label::LabelValueDefinitionStrings<S>>, 1595 >, 1596 core::option::Option<LabelValueDefinitionSeverity<S>>, 1597 ), 1598 _type: ::core::marker::PhantomData<fn() -> S>, 1599} 1600 1601impl<S: jacquard_common::BosStr> LabelValueDefinition<S> { 1602 /// Create a new builder for this type. 1603 pub fn new() -> LabelValueDefinitionBuilder<S, label_value_definition_state::Empty> { 1604 LabelValueDefinitionBuilder::new() 1605 } 1606} 1607 1608impl< 1609 S: jacquard_common::BosStr, 1610> LabelValueDefinitionBuilder<S, label_value_definition_state::Empty> { 1611 /// Create a new builder with all fields unset. 1612 pub fn new() -> Self { 1613 LabelValueDefinitionBuilder { 1614 _state: ::core::marker::PhantomData, 1615 _fields: (None, None, None, None, None, None), 1616 _type: ::core::marker::PhantomData, 1617 } 1618 } 1619} 1620 1621impl< 1622 S: jacquard_common::BosStr, 1623 St: label_value_definition_state::State, 1624> LabelValueDefinitionBuilder<S, St> { 1625 /// Set the `adultOnly` field (optional) 1626 pub fn adult_only(mut self, value: impl Into<Option<bool>>) -> Self { 1627 self._fields.0 = value.into(); 1628 self 1629 } 1630 /// Set the `adultOnly` field to an Option value (optional) 1631 pub fn maybe_adult_only(mut self, value: Option<bool>) -> Self { 1632 self._fields.0 = value; 1633 self 1634 } 1635} 1636 1637impl<S: jacquard_common::BosStr, St> LabelValueDefinitionBuilder<S, St> 1638where 1639 St: label_value_definition_state::State, 1640 St::Blurs: label_value_definition_state::IsUnset, 1641{ 1642 /// Set the `blurs` field (required) 1643 pub fn blurs( 1644 mut self, 1645 value: impl Into<LabelValueDefinitionBlurs<S>>, 1646 ) -> LabelValueDefinitionBuilder<S, label_value_definition_state::SetBlurs<St>> { 1647 self._fields.1 = ::core::option::Option::Some(value.into()); 1648 LabelValueDefinitionBuilder { 1649 _state: ::core::marker::PhantomData, 1650 _fields: self._fields, 1651 _type: ::core::marker::PhantomData, 1652 } 1653 } 1654} 1655 1656impl< 1657 S: jacquard_common::BosStr, 1658 St: label_value_definition_state::State, 1659> LabelValueDefinitionBuilder<S, St> { 1660 /// Set the `defaultSetting` field (optional) 1661 pub fn default_setting( 1662 mut self, 1663 value: impl Into<Option<LabelValueDefinitionDefaultSetting<S>>>, 1664 ) -> Self { 1665 self._fields.2 = value.into(); 1666 self 1667 } 1668 /// Set the `defaultSetting` field to an Option value (optional) 1669 pub fn maybe_default_setting( 1670 mut self, 1671 value: Option<LabelValueDefinitionDefaultSetting<S>>, 1672 ) -> Self { 1673 self._fields.2 = value; 1674 self 1675 } 1676} 1677 1678impl<S: jacquard_common::BosStr, St> LabelValueDefinitionBuilder<S, St> 1679where 1680 St: label_value_definition_state::State, 1681 St::Identifier: label_value_definition_state::IsUnset, 1682{ 1683 /// Set the `identifier` field (required) 1684 pub fn identifier( 1685 mut self, 1686 value: impl Into<S>, 1687 ) -> LabelValueDefinitionBuilder< 1688 S, 1689 label_value_definition_state::SetIdentifier<St>, 1690 > { 1691 self._fields.3 = ::core::option::Option::Some(value.into()); 1692 LabelValueDefinitionBuilder { 1693 _state: ::core::marker::PhantomData, 1694 _fields: self._fields, 1695 _type: ::core::marker::PhantomData, 1696 } 1697 } 1698} 1699 1700impl<S: jacquard_common::BosStr, St> LabelValueDefinitionBuilder<S, St> 1701where 1702 St: label_value_definition_state::State, 1703 St::Locales: label_value_definition_state::IsUnset, 1704{ 1705 /// Set the `locales` field (required) 1706 pub fn locales( 1707 mut self, 1708 value: impl Into< 1709 Vec<crate::macro_mode::com_atproto::label::LabelValueDefinitionStrings<S>>, 1710 >, 1711 ) -> LabelValueDefinitionBuilder<S, label_value_definition_state::SetLocales<St>> { 1712 self._fields.4 = ::core::option::Option::Some(value.into()); 1713 LabelValueDefinitionBuilder { 1714 _state: ::core::marker::PhantomData, 1715 _fields: self._fields, 1716 _type: ::core::marker::PhantomData, 1717 } 1718 } 1719} 1720 1721impl<S: jacquard_common::BosStr, St> LabelValueDefinitionBuilder<S, St> 1722where 1723 St: label_value_definition_state::State, 1724 St::Severity: label_value_definition_state::IsUnset, 1725{ 1726 /// Set the `severity` field (required) 1727 pub fn severity( 1728 mut self, 1729 value: impl Into<LabelValueDefinitionSeverity<S>>, 1730 ) -> LabelValueDefinitionBuilder<S, label_value_definition_state::SetSeverity<St>> { 1731 self._fields.5 = ::core::option::Option::Some(value.into()); 1732 LabelValueDefinitionBuilder { 1733 _state: ::core::marker::PhantomData, 1734 _fields: self._fields, 1735 _type: ::core::marker::PhantomData, 1736 } 1737 } 1738} 1739 1740impl<S: jacquard_common::BosStr, St> LabelValueDefinitionBuilder<S, St> 1741where 1742 St: label_value_definition_state::State, 1743 St::Identifier: label_value_definition_state::IsSet, 1744 St::Blurs: label_value_definition_state::IsSet, 1745 St::Locales: label_value_definition_state::IsSet, 1746 St::Severity: label_value_definition_state::IsSet, 1747{ 1748 /// Build the final struct. 1749 pub fn build(self) -> LabelValueDefinition<S> { 1750 LabelValueDefinition { 1751 adult_only: self._fields.0, 1752 blurs: self._fields.1.unwrap(), 1753 default_setting: self._fields.2, 1754 identifier: self._fields.3.unwrap(), 1755 locales: self._fields.4.unwrap(), 1756 severity: self._fields.5.unwrap(), 1757 extra_data: Default::default(), 1758 } 1759 } 1760 /// Build the final struct with custom extra_data. 1761 pub fn build_with_data( 1762 self, 1763 extra_data: alloc::collections::BTreeMap< 1764 jacquard_common::deps::smol_str::SmolStr, 1765 jacquard_common::types::value::Data<S>, 1766 >, 1767 ) -> LabelValueDefinition<S> { 1768 LabelValueDefinition { 1769 adult_only: self._fields.0, 1770 blurs: self._fields.1.unwrap(), 1771 default_setting: self._fields.2, 1772 identifier: self._fields.3.unwrap(), 1773 locales: self._fields.4.unwrap(), 1774 severity: self._fields.5.unwrap(), 1775 extra_data: Some(extra_data), 1776 } 1777 } 1778} 1779 1780pub mod label_value_definition_strings_state { 1781 1782 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 1783 #[allow(unused)] 1784 use ::core::marker::PhantomData; 1785 mod sealed { 1786 pub trait Sealed {} 1787 } 1788 /// State trait tracking which required fields have been set 1789 pub trait State: sealed::Sealed { 1790 type Name; 1791 type Lang; 1792 type Description; 1793 } 1794 /// Empty state - all required fields are unset 1795 pub struct Empty(()); 1796 impl sealed::Sealed for Empty {} 1797 impl State for Empty { 1798 type Name = Unset; 1799 type Lang = Unset; 1800 type Description = Unset; 1801 } 1802 ///State transition - sets the `name` field to Set 1803 pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>); 1804 impl<St: State> sealed::Sealed for SetName<St> {} 1805 impl<St: State> State for SetName<St> { 1806 type Name = Set<members::name>; 1807 type Lang = St::Lang; 1808 type Description = St::Description; 1809 } 1810 ///State transition - sets the `lang` field to Set 1811 pub struct SetLang<St: State = Empty>(PhantomData<fn() -> St>); 1812 impl<St: State> sealed::Sealed for SetLang<St> {} 1813 impl<St: State> State for SetLang<St> { 1814 type Name = St::Name; 1815 type Lang = Set<members::lang>; 1816 type Description = St::Description; 1817 } 1818 ///State transition - sets the `description` field to Set 1819 pub struct SetDescription<St: State = Empty>(PhantomData<fn() -> St>); 1820 impl<St: State> sealed::Sealed for SetDescription<St> {} 1821 impl<St: State> State for SetDescription<St> { 1822 type Name = St::Name; 1823 type Lang = St::Lang; 1824 type Description = Set<members::description>; 1825 } 1826 /// Marker types for field names 1827 #[allow(non_camel_case_types)] 1828 pub mod members { 1829 ///Marker type for the `name` field 1830 pub struct name(()); 1831 ///Marker type for the `lang` field 1832 pub struct lang(()); 1833 ///Marker type for the `description` field 1834 pub struct description(()); 1835 } 1836} 1837 1838/// Builder for constructing an instance of this type. 1839pub struct LabelValueDefinitionStringsBuilder< 1840 S: jacquard_common::BosStr, 1841 St: label_value_definition_strings_state::State, 1842> { 1843 _state: ::core::marker::PhantomData<fn() -> St>, 1844 _fields: ( 1845 core::option::Option<S>, 1846 core::option::Option<jacquard_common::types::string::Language>, 1847 core::option::Option<S>, 1848 ), 1849 _type: ::core::marker::PhantomData<fn() -> S>, 1850} 1851 1852impl<S: jacquard_common::BosStr> LabelValueDefinitionStrings<S> { 1853 /// Create a new builder for this type. 1854 pub fn new() -> LabelValueDefinitionStringsBuilder< 1855 S, 1856 label_value_definition_strings_state::Empty, 1857 > { 1858 LabelValueDefinitionStringsBuilder::new() 1859 } 1860} 1861 1862impl< 1863 S: jacquard_common::BosStr, 1864> LabelValueDefinitionStringsBuilder<S, label_value_definition_strings_state::Empty> { 1865 /// Create a new builder with all fields unset. 1866 pub fn new() -> Self { 1867 LabelValueDefinitionStringsBuilder { 1868 _state: ::core::marker::PhantomData, 1869 _fields: (None, None, None), 1870 _type: ::core::marker::PhantomData, 1871 } 1872 } 1873} 1874 1875impl<S: jacquard_common::BosStr, St> LabelValueDefinitionStringsBuilder<S, St> 1876where 1877 St: label_value_definition_strings_state::State, 1878 St::Description: label_value_definition_strings_state::IsUnset, 1879{ 1880 /// Set the `description` field (required) 1881 pub fn description( 1882 mut self, 1883 value: impl Into<S>, 1884 ) -> LabelValueDefinitionStringsBuilder< 1885 S, 1886 label_value_definition_strings_state::SetDescription<St>, 1887 > { 1888 self._fields.0 = ::core::option::Option::Some(value.into()); 1889 LabelValueDefinitionStringsBuilder { 1890 _state: ::core::marker::PhantomData, 1891 _fields: self._fields, 1892 _type: ::core::marker::PhantomData, 1893 } 1894 } 1895} 1896 1897impl<S: jacquard_common::BosStr, St> LabelValueDefinitionStringsBuilder<S, St> 1898where 1899 St: label_value_definition_strings_state::State, 1900 St::Lang: label_value_definition_strings_state::IsUnset, 1901{ 1902 /// Set the `lang` field (required) 1903 pub fn lang( 1904 mut self, 1905 value: impl Into<jacquard_common::types::string::Language>, 1906 ) -> LabelValueDefinitionStringsBuilder< 1907 S, 1908 label_value_definition_strings_state::SetLang<St>, 1909 > { 1910 self._fields.1 = ::core::option::Option::Some(value.into()); 1911 LabelValueDefinitionStringsBuilder { 1912 _state: ::core::marker::PhantomData, 1913 _fields: self._fields, 1914 _type: ::core::marker::PhantomData, 1915 } 1916 } 1917} 1918 1919impl<S: jacquard_common::BosStr, St> LabelValueDefinitionStringsBuilder<S, St> 1920where 1921 St: label_value_definition_strings_state::State, 1922 St::Name: label_value_definition_strings_state::IsUnset, 1923{ 1924 /// Set the `name` field (required) 1925 pub fn name( 1926 mut self, 1927 value: impl Into<S>, 1928 ) -> LabelValueDefinitionStringsBuilder< 1929 S, 1930 label_value_definition_strings_state::SetName<St>, 1931 > { 1932 self._fields.2 = ::core::option::Option::Some(value.into()); 1933 LabelValueDefinitionStringsBuilder { 1934 _state: ::core::marker::PhantomData, 1935 _fields: self._fields, 1936 _type: ::core::marker::PhantomData, 1937 } 1938 } 1939} 1940 1941impl<S: jacquard_common::BosStr, St> LabelValueDefinitionStringsBuilder<S, St> 1942where 1943 St: label_value_definition_strings_state::State, 1944 St::Name: label_value_definition_strings_state::IsSet, 1945 St::Lang: label_value_definition_strings_state::IsSet, 1946 St::Description: label_value_definition_strings_state::IsSet, 1947{ 1948 /// Build the final struct. 1949 pub fn build(self) -> LabelValueDefinitionStrings<S> { 1950 LabelValueDefinitionStrings { 1951 description: self._fields.0.unwrap(), 1952 lang: self._fields.1.unwrap(), 1953 name: self._fields.2.unwrap(), 1954 extra_data: Default::default(), 1955 } 1956 } 1957 /// Build the final struct with custom extra_data. 1958 pub fn build_with_data( 1959 self, 1960 extra_data: alloc::collections::BTreeMap< 1961 jacquard_common::deps::smol_str::SmolStr, 1962 jacquard_common::types::value::Data<S>, 1963 >, 1964 ) -> LabelValueDefinitionStrings<S> { 1965 LabelValueDefinitionStrings { 1966 description: self._fields.0.unwrap(), 1967 lang: self._fields.1.unwrap(), 1968 name: self._fields.2.unwrap(), 1969 extra_data: Some(extra_data), 1970 } 1971 } 1972} 1973 1974pub mod self_labels_state { 1975 1976 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 1977 #[allow(unused)] 1978 use ::core::marker::PhantomData; 1979 mod sealed { 1980 pub trait Sealed {} 1981 } 1982 /// State trait tracking which required fields have been set 1983 pub trait State: sealed::Sealed { 1984 type Values; 1985 } 1986 /// Empty state - all required fields are unset 1987 pub struct Empty(()); 1988 impl sealed::Sealed for Empty {} 1989 impl State for Empty { 1990 type Values = Unset; 1991 } 1992 ///State transition - sets the `values` field to Set 1993 pub struct SetValues<St: State = Empty>(PhantomData<fn() -> St>); 1994 impl<St: State> sealed::Sealed for SetValues<St> {} 1995 impl<St: State> State for SetValues<St> { 1996 type Values = Set<members::values>; 1997 } 1998 /// Marker types for field names 1999 #[allow(non_camel_case_types)] 2000 pub mod members { 2001 ///Marker type for the `values` field 2002 pub struct values(()); 2003 } 2004} 2005 2006/// Builder for constructing an instance of this type. 2007pub struct SelfLabelsBuilder<S: jacquard_common::BosStr, St: self_labels_state::State> { 2008 _state: ::core::marker::PhantomData<fn() -> St>, 2009 _fields: ( 2010 core::option::Option<Vec<crate::macro_mode::com_atproto::label::SelfLabel<S>>>, 2011 ), 2012 _type: ::core::marker::PhantomData<fn() -> S>, 2013} 2014 2015impl<S: jacquard_common::BosStr> SelfLabels<S> { 2016 /// Create a new builder for this type. 2017 pub fn new() -> SelfLabelsBuilder<S, self_labels_state::Empty> { 2018 SelfLabelsBuilder::new() 2019 } 2020} 2021 2022impl<S: jacquard_common::BosStr> SelfLabelsBuilder<S, self_labels_state::Empty> { 2023 /// Create a new builder with all fields unset. 2024 pub fn new() -> Self { 2025 SelfLabelsBuilder { 2026 _state: ::core::marker::PhantomData, 2027 _fields: (None,), 2028 _type: ::core::marker::PhantomData, 2029 } 2030 } 2031} 2032 2033impl<S: jacquard_common::BosStr, St> SelfLabelsBuilder<S, St> 2034where 2035 St: self_labels_state::State, 2036 St::Values: self_labels_state::IsUnset, 2037{ 2038 /// Set the `values` field (required) 2039 pub fn values( 2040 mut self, 2041 value: impl Into<Vec<crate::macro_mode::com_atproto::label::SelfLabel<S>>>, 2042 ) -> SelfLabelsBuilder<S, self_labels_state::SetValues<St>> { 2043 self._fields.0 = ::core::option::Option::Some(value.into()); 2044 SelfLabelsBuilder { 2045 _state: ::core::marker::PhantomData, 2046 _fields: self._fields, 2047 _type: ::core::marker::PhantomData, 2048 } 2049 } 2050} 2051 2052impl<S: jacquard_common::BosStr, St> SelfLabelsBuilder<S, St> 2053where 2054 St: self_labels_state::State, 2055 St::Values: self_labels_state::IsSet, 2056{ 2057 /// Build the final struct. 2058 pub fn build(self) -> SelfLabels<S> { 2059 SelfLabels { 2060 values: self._fields.0.unwrap(), 2061 extra_data: Default::default(), 2062 } 2063 } 2064 /// Build the final struct with custom extra_data. 2065 pub fn build_with_data( 2066 self, 2067 extra_data: alloc::collections::BTreeMap< 2068 jacquard_common::deps::smol_str::SmolStr, 2069 jacquard_common::types::value::Data<S>, 2070 >, 2071 ) -> SelfLabels<S> { 2072 SelfLabels { 2073 values: self._fields.0.unwrap(), 2074 extra_data: Some(extra_data), 2075 } 2076 } 2077}