Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol. wisp.place
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: place.wisp.fs 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8#[jacquard_derive::lexicon] 9#[derive( 10 serde::Serialize, 11 serde::Deserialize, 12 Debug, 13 Clone, 14 PartialEq, 15 Eq, 16 jacquard_derive::IntoStatic 17)] 18#[serde(rename_all = "camelCase")] 19pub struct Directory<'a> { 20 #[serde(borrow)] 21 pub entries: Vec<crate::place_wisp::fs::Entry<'a>>, 22 #[serde(borrow)] 23 pub r#type: jacquard_common::CowStr<'a>, 24} 25 26pub mod directory_state { 27 28 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 29 #[allow(unused)] 30 use ::core::marker::PhantomData; 31 mod sealed { 32 pub trait Sealed {} 33 } 34 /// State trait tracking which required fields have been set 35 pub trait State: sealed::Sealed { 36 type Type; 37 type Entries; 38 } 39 /// Empty state - all required fields are unset 40 pub struct Empty(()); 41 impl sealed::Sealed for Empty {} 42 impl State for Empty { 43 type Type = Unset; 44 type Entries = Unset; 45 } 46 ///State transition - sets the `type` field to Set 47 pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>); 48 impl<S: State> sealed::Sealed for SetType<S> {} 49 impl<S: State> State for SetType<S> { 50 type Type = Set<members::r#type>; 51 type Entries = S::Entries; 52 } 53 ///State transition - sets the `entries` field to Set 54 pub struct SetEntries<S: State = Empty>(PhantomData<fn() -> S>); 55 impl<S: State> sealed::Sealed for SetEntries<S> {} 56 impl<S: State> State for SetEntries<S> { 57 type Type = S::Type; 58 type Entries = Set<members::entries>; 59 } 60 /// Marker types for field names 61 #[allow(non_camel_case_types)] 62 pub mod members { 63 ///Marker type for the `type` field 64 pub struct r#type(()); 65 ///Marker type for the `entries` field 66 pub struct entries(()); 67 } 68} 69 70/// Builder for constructing an instance of this type 71pub struct DirectoryBuilder<'a, S: directory_state::State> { 72 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 73 __unsafe_private_named: ( 74 ::core::option::Option<Vec<crate::place_wisp::fs::Entry<'a>>>, 75 ::core::option::Option<jacquard_common::CowStr<'a>>, 76 ), 77 _phantom: ::core::marker::PhantomData<&'a ()>, 78} 79 80impl<'a> Directory<'a> { 81 /// Create a new builder for this type 82 pub fn new() -> DirectoryBuilder<'a, directory_state::Empty> { 83 DirectoryBuilder::new() 84 } 85} 86 87impl<'a> DirectoryBuilder<'a, directory_state::Empty> { 88 /// Create a new builder with all fields unset 89 pub fn new() -> Self { 90 DirectoryBuilder { 91 _phantom_state: ::core::marker::PhantomData, 92 __unsafe_private_named: (None, None), 93 _phantom: ::core::marker::PhantomData, 94 } 95 } 96} 97 98impl<'a, S> DirectoryBuilder<'a, S> 99where 100 S: directory_state::State, 101 S::Entries: directory_state::IsUnset, 102{ 103 /// Set the `entries` field (required) 104 pub fn entries( 105 mut self, 106 value: impl Into<Vec<crate::place_wisp::fs::Entry<'a>>>, 107 ) -> DirectoryBuilder<'a, directory_state::SetEntries<S>> { 108 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 109 DirectoryBuilder { 110 _phantom_state: ::core::marker::PhantomData, 111 __unsafe_private_named: self.__unsafe_private_named, 112 _phantom: ::core::marker::PhantomData, 113 } 114 } 115} 116 117impl<'a, S> DirectoryBuilder<'a, S> 118where 119 S: directory_state::State, 120 S::Type: directory_state::IsUnset, 121{ 122 /// Set the `type` field (required) 123 pub fn r#type( 124 mut self, 125 value: impl Into<jacquard_common::CowStr<'a>>, 126 ) -> DirectoryBuilder<'a, directory_state::SetType<S>> { 127 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 128 DirectoryBuilder { 129 _phantom_state: ::core::marker::PhantomData, 130 __unsafe_private_named: self.__unsafe_private_named, 131 _phantom: ::core::marker::PhantomData, 132 } 133 } 134} 135 136impl<'a, S> DirectoryBuilder<'a, S> 137where 138 S: directory_state::State, 139 S::Type: directory_state::IsSet, 140 S::Entries: directory_state::IsSet, 141{ 142 /// Build the final struct 143 pub fn build(self) -> Directory<'a> { 144 Directory { 145 entries: self.__unsafe_private_named.0.unwrap(), 146 r#type: self.__unsafe_private_named.1.unwrap(), 147 extra_data: Default::default(), 148 } 149 } 150 /// Build the final struct with custom extra_data 151 pub fn build_with_data( 152 self, 153 extra_data: std::collections::BTreeMap< 154 jacquard_common::smol_str::SmolStr, 155 jacquard_common::types::value::Data<'a>, 156 >, 157 ) -> Directory<'a> { 158 Directory { 159 entries: self.__unsafe_private_named.0.unwrap(), 160 r#type: self.__unsafe_private_named.1.unwrap(), 161 extra_data: Some(extra_data), 162 } 163 } 164} 165 166fn lexicon_doc_place_wisp_fs() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 167 ::jacquard_lexicon::lexicon::LexiconDoc { 168 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, 169 id: ::jacquard_common::CowStr::new_static("place.wisp.fs"), 170 revision: None, 171 description: None, 172 defs: { 173 let mut map = ::std::collections::BTreeMap::new(); 174 map.insert( 175 ::jacquard_common::smol_str::SmolStr::new_static("directory"), 176 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 177 description: None, 178 required: Some( 179 vec![ 180 ::jacquard_common::smol_str::SmolStr::new_static("type"), 181 ::jacquard_common::smol_str::SmolStr::new_static("entries") 182 ], 183 ), 184 nullable: None, 185 properties: { 186 #[allow(unused_mut)] 187 let mut map = ::std::collections::BTreeMap::new(); 188 map.insert( 189 ::jacquard_common::smol_str::SmolStr::new_static("entries"), 190 ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { 191 description: None, 192 items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef { 193 description: None, 194 r#ref: ::jacquard_common::CowStr::new_static("#entry"), 195 }), 196 min_length: None, 197 max_length: Some(500usize), 198 }), 199 ); 200 map.insert( 201 ::jacquard_common::smol_str::SmolStr::new_static("type"), 202 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 203 description: None, 204 format: None, 205 default: None, 206 min_length: None, 207 max_length: None, 208 min_graphemes: None, 209 max_graphemes: None, 210 r#enum: None, 211 r#const: None, 212 known_values: None, 213 }), 214 ); 215 map 216 }, 217 }), 218 ); 219 map.insert( 220 ::jacquard_common::smol_str::SmolStr::new_static("entry"), 221 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 222 description: None, 223 required: Some( 224 vec![ 225 ::jacquard_common::smol_str::SmolStr::new_static("name"), 226 ::jacquard_common::smol_str::SmolStr::new_static("node") 227 ], 228 ), 229 nullable: None, 230 properties: { 231 #[allow(unused_mut)] 232 let mut map = ::std::collections::BTreeMap::new(); 233 map.insert( 234 ::jacquard_common::smol_str::SmolStr::new_static("name"), 235 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 236 description: None, 237 format: None, 238 default: None, 239 min_length: None, 240 max_length: Some(255usize), 241 min_graphemes: None, 242 max_graphemes: None, 243 r#enum: None, 244 r#const: None, 245 known_values: None, 246 }), 247 ); 248 map.insert( 249 ::jacquard_common::smol_str::SmolStr::new_static("node"), 250 ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { 251 description: None, 252 refs: vec![ 253 ::jacquard_common::CowStr::new_static("#file"), 254 ::jacquard_common::CowStr::new_static("#directory"), 255 ::jacquard_common::CowStr::new_static("#subfs") 256 ], 257 closed: None, 258 }), 259 ); 260 map 261 }, 262 }), 263 ); 264 map.insert( 265 ::jacquard_common::smol_str::SmolStr::new_static("file"), 266 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 267 description: None, 268 required: Some( 269 vec![ 270 ::jacquard_common::smol_str::SmolStr::new_static("type"), 271 ::jacquard_common::smol_str::SmolStr::new_static("blob") 272 ], 273 ), 274 nullable: None, 275 properties: { 276 #[allow(unused_mut)] 277 let mut map = ::std::collections::BTreeMap::new(); 278 map.insert( 279 ::jacquard_common::smol_str::SmolStr::new_static("base64"), 280 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { 281 description: None, 282 default: None, 283 r#const: None, 284 }), 285 ); 286 map.insert( 287 ::jacquard_common::smol_str::SmolStr::new_static("blob"), 288 ::jacquard_lexicon::lexicon::LexObjectProperty::Blob(::jacquard_lexicon::lexicon::LexBlob { 289 description: None, 290 accept: None, 291 max_size: None, 292 }), 293 ); 294 map.insert( 295 ::jacquard_common::smol_str::SmolStr::new_static("encoding"), 296 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 297 description: Some( 298 ::jacquard_common::CowStr::new_static( 299 "Content encoding (e.g., gzip for compressed files)", 300 ), 301 ), 302 format: None, 303 default: None, 304 min_length: None, 305 max_length: None, 306 min_graphemes: None, 307 max_graphemes: None, 308 r#enum: None, 309 r#const: None, 310 known_values: None, 311 }), 312 ); 313 map.insert( 314 ::jacquard_common::smol_str::SmolStr::new_static("mimeType"), 315 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 316 description: Some( 317 ::jacquard_common::CowStr::new_static( 318 "Original MIME type before compression", 319 ), 320 ), 321 format: None, 322 default: None, 323 min_length: None, 324 max_length: None, 325 min_graphemes: None, 326 max_graphemes: None, 327 r#enum: None, 328 r#const: None, 329 known_values: None, 330 }), 331 ); 332 map.insert( 333 ::jacquard_common::smol_str::SmolStr::new_static("type"), 334 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 335 description: None, 336 format: None, 337 default: None, 338 min_length: None, 339 max_length: None, 340 min_graphemes: None, 341 max_graphemes: None, 342 r#enum: None, 343 r#const: None, 344 known_values: None, 345 }), 346 ); 347 map 348 }, 349 }), 350 ); 351 map.insert( 352 ::jacquard_common::smol_str::SmolStr::new_static("main"), 353 ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { 354 description: Some( 355 ::jacquard_common::CowStr::new_static( 356 "Virtual filesystem manifest for a Wisp site", 357 ), 358 ), 359 key: None, 360 record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { 361 description: None, 362 required: Some( 363 vec![ 364 ::jacquard_common::smol_str::SmolStr::new_static("site"), 365 ::jacquard_common::smol_str::SmolStr::new_static("root"), 366 ::jacquard_common::smol_str::SmolStr::new_static("createdAt") 367 ], 368 ), 369 nullable: None, 370 properties: { 371 #[allow(unused_mut)] 372 let mut map = ::std::collections::BTreeMap::new(); 373 map.insert( 374 ::jacquard_common::smol_str::SmolStr::new_static( 375 "createdAt", 376 ), 377 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 378 description: None, 379 format: Some( 380 ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, 381 ), 382 default: None, 383 min_length: None, 384 max_length: None, 385 min_graphemes: None, 386 max_graphemes: None, 387 r#enum: None, 388 r#const: None, 389 known_values: None, 390 }), 391 ); 392 map.insert( 393 ::jacquard_common::smol_str::SmolStr::new_static( 394 "fileCount", 395 ), 396 ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { 397 description: None, 398 default: None, 399 minimum: Some(0i64), 400 maximum: Some(1000i64), 401 r#enum: None, 402 r#const: None, 403 }), 404 ); 405 map.insert( 406 ::jacquard_common::smol_str::SmolStr::new_static("root"), 407 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { 408 description: None, 409 r#ref: ::jacquard_common::CowStr::new_static("#directory"), 410 }), 411 ); 412 map.insert( 413 ::jacquard_common::smol_str::SmolStr::new_static("site"), 414 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 415 description: None, 416 format: None, 417 default: None, 418 min_length: None, 419 max_length: None, 420 min_graphemes: None, 421 max_graphemes: None, 422 r#enum: None, 423 r#const: None, 424 known_values: None, 425 }), 426 ); 427 map 428 }, 429 }), 430 }), 431 ); 432 map.insert( 433 ::jacquard_common::smol_str::SmolStr::new_static("subfs"), 434 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { 435 description: None, 436 required: Some( 437 vec![ 438 ::jacquard_common::smol_str::SmolStr::new_static("type"), 439 ::jacquard_common::smol_str::SmolStr::new_static("subject") 440 ], 441 ), 442 nullable: None, 443 properties: { 444 #[allow(unused_mut)] 445 let mut map = ::std::collections::BTreeMap::new(); 446 map.insert( 447 ::jacquard_common::smol_str::SmolStr::new_static("flat"), 448 ::jacquard_lexicon::lexicon::LexObjectProperty::Boolean(::jacquard_lexicon::lexicon::LexBoolean { 449 description: None, 450 default: None, 451 r#const: None, 452 }), 453 ); 454 map.insert( 455 ::jacquard_common::smol_str::SmolStr::new_static("subject"), 456 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 457 description: Some( 458 ::jacquard_common::CowStr::new_static( 459 "AT-URI pointing to a place.wisp.subfs record containing this subtree.", 460 ), 461 ), 462 format: Some( 463 ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, 464 ), 465 default: None, 466 min_length: None, 467 max_length: None, 468 min_graphemes: None, 469 max_graphemes: None, 470 r#enum: None, 471 r#const: None, 472 known_values: None, 473 }), 474 ); 475 map.insert( 476 ::jacquard_common::smol_str::SmolStr::new_static("type"), 477 ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { 478 description: None, 479 format: None, 480 default: None, 481 min_length: None, 482 max_length: None, 483 min_graphemes: None, 484 max_graphemes: None, 485 r#enum: None, 486 r#const: None, 487 known_values: None, 488 }), 489 ); 490 map 491 }, 492 }), 493 ); 494 map 495 }, 496 } 497} 498 499impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Directory<'a> { 500 fn nsid() -> &'static str { 501 "place.wisp.fs" 502 } 503 fn def_name() -> &'static str { 504 "directory" 505 } 506 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 507 lexicon_doc_place_wisp_fs() 508 } 509 fn validate( 510 &self, 511 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 512 { 513 let value = &self.entries; 514 #[allow(unused_comparisons)] 515 if value.len() > 500usize { 516 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { 517 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 518 "entries", 519 ), 520 max: 500usize, 521 actual: value.len(), 522 }); 523 } 524 } 525 Ok(()) 526 } 527} 528 529#[jacquard_derive::lexicon] 530#[derive( 531 serde::Serialize, 532 serde::Deserialize, 533 Debug, 534 Clone, 535 PartialEq, 536 Eq, 537 jacquard_derive::IntoStatic 538)] 539#[serde(rename_all = "camelCase")] 540pub struct Entry<'a> { 541 #[serde(borrow)] 542 pub name: jacquard_common::CowStr<'a>, 543 #[serde(borrow)] 544 pub node: EntryNode<'a>, 545} 546 547pub mod entry_state { 548 549 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 550 #[allow(unused)] 551 use ::core::marker::PhantomData; 552 mod sealed { 553 pub trait Sealed {} 554 } 555 /// State trait tracking which required fields have been set 556 pub trait State: sealed::Sealed { 557 type Name; 558 type Node; 559 } 560 /// Empty state - all required fields are unset 561 pub struct Empty(()); 562 impl sealed::Sealed for Empty {} 563 impl State for Empty { 564 type Name = Unset; 565 type Node = Unset; 566 } 567 ///State transition - sets the `name` field to Set 568 pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>); 569 impl<S: State> sealed::Sealed for SetName<S> {} 570 impl<S: State> State for SetName<S> { 571 type Name = Set<members::name>; 572 type Node = S::Node; 573 } 574 ///State transition - sets the `node` field to Set 575 pub struct SetNode<S: State = Empty>(PhantomData<fn() -> S>); 576 impl<S: State> sealed::Sealed for SetNode<S> {} 577 impl<S: State> State for SetNode<S> { 578 type Name = S::Name; 579 type Node = Set<members::node>; 580 } 581 /// Marker types for field names 582 #[allow(non_camel_case_types)] 583 pub mod members { 584 ///Marker type for the `name` field 585 pub struct name(()); 586 ///Marker type for the `node` field 587 pub struct node(()); 588 } 589} 590 591/// Builder for constructing an instance of this type 592pub struct EntryBuilder<'a, S: entry_state::State> { 593 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 594 __unsafe_private_named: ( 595 ::core::option::Option<jacquard_common::CowStr<'a>>, 596 ::core::option::Option<EntryNode<'a>>, 597 ), 598 _phantom: ::core::marker::PhantomData<&'a ()>, 599} 600 601impl<'a> Entry<'a> { 602 /// Create a new builder for this type 603 pub fn new() -> EntryBuilder<'a, entry_state::Empty> { 604 EntryBuilder::new() 605 } 606} 607 608impl<'a> EntryBuilder<'a, entry_state::Empty> { 609 /// Create a new builder with all fields unset 610 pub fn new() -> Self { 611 EntryBuilder { 612 _phantom_state: ::core::marker::PhantomData, 613 __unsafe_private_named: (None, None), 614 _phantom: ::core::marker::PhantomData, 615 } 616 } 617} 618 619impl<'a, S> EntryBuilder<'a, S> 620where 621 S: entry_state::State, 622 S::Name: entry_state::IsUnset, 623{ 624 /// Set the `name` field (required) 625 pub fn name( 626 mut self, 627 value: impl Into<jacquard_common::CowStr<'a>>, 628 ) -> EntryBuilder<'a, entry_state::SetName<S>> { 629 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 630 EntryBuilder { 631 _phantom_state: ::core::marker::PhantomData, 632 __unsafe_private_named: self.__unsafe_private_named, 633 _phantom: ::core::marker::PhantomData, 634 } 635 } 636} 637 638impl<'a, S> EntryBuilder<'a, S> 639where 640 S: entry_state::State, 641 S::Node: entry_state::IsUnset, 642{ 643 /// Set the `node` field (required) 644 pub fn node( 645 mut self, 646 value: impl Into<EntryNode<'a>>, 647 ) -> EntryBuilder<'a, entry_state::SetNode<S>> { 648 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 649 EntryBuilder { 650 _phantom_state: ::core::marker::PhantomData, 651 __unsafe_private_named: self.__unsafe_private_named, 652 _phantom: ::core::marker::PhantomData, 653 } 654 } 655} 656 657impl<'a, S> EntryBuilder<'a, S> 658where 659 S: entry_state::State, 660 S::Name: entry_state::IsSet, 661 S::Node: entry_state::IsSet, 662{ 663 /// Build the final struct 664 pub fn build(self) -> Entry<'a> { 665 Entry { 666 name: self.__unsafe_private_named.0.unwrap(), 667 node: self.__unsafe_private_named.1.unwrap(), 668 extra_data: Default::default(), 669 } 670 } 671 /// Build the final struct with custom extra_data 672 pub fn build_with_data( 673 self, 674 extra_data: std::collections::BTreeMap< 675 jacquard_common::smol_str::SmolStr, 676 jacquard_common::types::value::Data<'a>, 677 >, 678 ) -> Entry<'a> { 679 Entry { 680 name: self.__unsafe_private_named.0.unwrap(), 681 node: self.__unsafe_private_named.1.unwrap(), 682 extra_data: Some(extra_data), 683 } 684 } 685} 686 687#[jacquard_derive::open_union] 688#[derive( 689 serde::Serialize, 690 serde::Deserialize, 691 Debug, 692 Clone, 693 PartialEq, 694 Eq, 695 jacquard_derive::IntoStatic 696)] 697#[serde(tag = "$type")] 698#[serde(bound(deserialize = "'de: 'a"))] 699pub enum EntryNode<'a> { 700 #[serde(rename = "place.wisp.fs#file")] 701 File(Box<crate::place_wisp::fs::File<'a>>), 702 #[serde(rename = "place.wisp.fs#directory")] 703 Directory(Box<crate::place_wisp::fs::Directory<'a>>), 704 #[serde(rename = "place.wisp.fs#subfs")] 705 Subfs(Box<crate::place_wisp::fs::Subfs<'a>>), 706} 707 708impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Entry<'a> { 709 fn nsid() -> &'static str { 710 "place.wisp.fs" 711 } 712 fn def_name() -> &'static str { 713 "entry" 714 } 715 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 716 lexicon_doc_place_wisp_fs() 717 } 718 fn validate( 719 &self, 720 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 721 { 722 let value = &self.name; 723 #[allow(unused_comparisons)] 724 if <str>::len(value.as_ref()) > 255usize { 725 return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength { 726 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 727 "name", 728 ), 729 max: 255usize, 730 actual: <str>::len(value.as_ref()), 731 }); 732 } 733 } 734 Ok(()) 735 } 736} 737 738#[jacquard_derive::lexicon] 739#[derive( 740 serde::Serialize, 741 serde::Deserialize, 742 Debug, 743 Clone, 744 PartialEq, 745 Eq, 746 jacquard_derive::IntoStatic 747)] 748#[serde(rename_all = "camelCase")] 749pub struct File<'a> { 750 /// True if blob content is base64-encoded (used to bypass PDS content sniffing) 751 #[serde(skip_serializing_if = "std::option::Option::is_none")] 752 pub base64: Option<bool>, 753 /// Content blob ref 754 #[serde(borrow)] 755 pub blob: jacquard_common::types::blob::BlobRef<'a>, 756 /// Content encoding (e.g., gzip for compressed files) 757 #[serde(skip_serializing_if = "std::option::Option::is_none")] 758 #[serde(borrow)] 759 pub encoding: Option<jacquard_common::CowStr<'a>>, 760 /// Original MIME type before compression 761 #[serde(skip_serializing_if = "std::option::Option::is_none")] 762 #[serde(borrow)] 763 pub mime_type: Option<jacquard_common::CowStr<'a>>, 764 #[serde(borrow)] 765 pub r#type: jacquard_common::CowStr<'a>, 766} 767 768pub mod file_state { 769 770 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 771 #[allow(unused)] 772 use ::core::marker::PhantomData; 773 mod sealed { 774 pub trait Sealed {} 775 } 776 /// State trait tracking which required fields have been set 777 pub trait State: sealed::Sealed { 778 type Type; 779 type Blob; 780 } 781 /// Empty state - all required fields are unset 782 pub struct Empty(()); 783 impl sealed::Sealed for Empty {} 784 impl State for Empty { 785 type Type = Unset; 786 type Blob = Unset; 787 } 788 ///State transition - sets the `type` field to Set 789 pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>); 790 impl<S: State> sealed::Sealed for SetType<S> {} 791 impl<S: State> State for SetType<S> { 792 type Type = Set<members::r#type>; 793 type Blob = S::Blob; 794 } 795 ///State transition - sets the `blob` field to Set 796 pub struct SetBlob<S: State = Empty>(PhantomData<fn() -> S>); 797 impl<S: State> sealed::Sealed for SetBlob<S> {} 798 impl<S: State> State for SetBlob<S> { 799 type Type = S::Type; 800 type Blob = Set<members::blob>; 801 } 802 /// Marker types for field names 803 #[allow(non_camel_case_types)] 804 pub mod members { 805 ///Marker type for the `type` field 806 pub struct r#type(()); 807 ///Marker type for the `blob` field 808 pub struct blob(()); 809 } 810} 811 812/// Builder for constructing an instance of this type 813pub struct FileBuilder<'a, S: file_state::State> { 814 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 815 __unsafe_private_named: ( 816 ::core::option::Option<bool>, 817 ::core::option::Option<jacquard_common::types::blob::BlobRef<'a>>, 818 ::core::option::Option<jacquard_common::CowStr<'a>>, 819 ::core::option::Option<jacquard_common::CowStr<'a>>, 820 ::core::option::Option<jacquard_common::CowStr<'a>>, 821 ), 822 _phantom: ::core::marker::PhantomData<&'a ()>, 823} 824 825impl<'a> File<'a> { 826 /// Create a new builder for this type 827 pub fn new() -> FileBuilder<'a, file_state::Empty> { 828 FileBuilder::new() 829 } 830} 831 832impl<'a> FileBuilder<'a, file_state::Empty> { 833 /// Create a new builder with all fields unset 834 pub fn new() -> Self { 835 FileBuilder { 836 _phantom_state: ::core::marker::PhantomData, 837 __unsafe_private_named: (None, None, None, None, None), 838 _phantom: ::core::marker::PhantomData, 839 } 840 } 841} 842 843impl<'a, S: file_state::State> FileBuilder<'a, S> { 844 /// Set the `base64` field (optional) 845 pub fn base64(mut self, value: impl Into<Option<bool>>) -> Self { 846 self.__unsafe_private_named.0 = value.into(); 847 self 848 } 849 /// Set the `base64` field to an Option value (optional) 850 pub fn maybe_base64(mut self, value: Option<bool>) -> Self { 851 self.__unsafe_private_named.0 = value; 852 self 853 } 854} 855 856impl<'a, S> FileBuilder<'a, S> 857where 858 S: file_state::State, 859 S::Blob: file_state::IsUnset, 860{ 861 /// Set the `blob` field (required) 862 pub fn blob( 863 mut self, 864 value: impl Into<jacquard_common::types::blob::BlobRef<'a>>, 865 ) -> FileBuilder<'a, file_state::SetBlob<S>> { 866 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 867 FileBuilder { 868 _phantom_state: ::core::marker::PhantomData, 869 __unsafe_private_named: self.__unsafe_private_named, 870 _phantom: ::core::marker::PhantomData, 871 } 872 } 873} 874 875impl<'a, S: file_state::State> FileBuilder<'a, S> { 876 /// Set the `encoding` field (optional) 877 pub fn encoding( 878 mut self, 879 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 880 ) -> Self { 881 self.__unsafe_private_named.2 = value.into(); 882 self 883 } 884 /// Set the `encoding` field to an Option value (optional) 885 pub fn maybe_encoding(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self { 886 self.__unsafe_private_named.2 = value; 887 self 888 } 889} 890 891impl<'a, S: file_state::State> FileBuilder<'a, S> { 892 /// Set the `mimeType` field (optional) 893 pub fn mime_type( 894 mut self, 895 value: impl Into<Option<jacquard_common::CowStr<'a>>>, 896 ) -> Self { 897 self.__unsafe_private_named.3 = value.into(); 898 self 899 } 900 /// Set the `mimeType` field to an Option value (optional) 901 pub fn maybe_mime_type( 902 mut self, 903 value: Option<jacquard_common::CowStr<'a>>, 904 ) -> Self { 905 self.__unsafe_private_named.3 = value; 906 self 907 } 908} 909 910impl<'a, S> FileBuilder<'a, S> 911where 912 S: file_state::State, 913 S::Type: file_state::IsUnset, 914{ 915 /// Set the `type` field (required) 916 pub fn r#type( 917 mut self, 918 value: impl Into<jacquard_common::CowStr<'a>>, 919 ) -> FileBuilder<'a, file_state::SetType<S>> { 920 self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); 921 FileBuilder { 922 _phantom_state: ::core::marker::PhantomData, 923 __unsafe_private_named: self.__unsafe_private_named, 924 _phantom: ::core::marker::PhantomData, 925 } 926 } 927} 928 929impl<'a, S> FileBuilder<'a, S> 930where 931 S: file_state::State, 932 S::Type: file_state::IsSet, 933 S::Blob: file_state::IsSet, 934{ 935 /// Build the final struct 936 pub fn build(self) -> File<'a> { 937 File { 938 base64: self.__unsafe_private_named.0, 939 blob: self.__unsafe_private_named.1.unwrap(), 940 encoding: self.__unsafe_private_named.2, 941 mime_type: self.__unsafe_private_named.3, 942 r#type: self.__unsafe_private_named.4.unwrap(), 943 extra_data: Default::default(), 944 } 945 } 946 /// Build the final struct with custom extra_data 947 pub fn build_with_data( 948 self, 949 extra_data: std::collections::BTreeMap< 950 jacquard_common::smol_str::SmolStr, 951 jacquard_common::types::value::Data<'a>, 952 >, 953 ) -> File<'a> { 954 File { 955 base64: self.__unsafe_private_named.0, 956 blob: self.__unsafe_private_named.1.unwrap(), 957 encoding: self.__unsafe_private_named.2, 958 mime_type: self.__unsafe_private_named.3, 959 r#type: self.__unsafe_private_named.4.unwrap(), 960 extra_data: Some(extra_data), 961 } 962 } 963} 964 965impl<'a> ::jacquard_lexicon::schema::LexiconSchema for File<'a> { 966 fn nsid() -> &'static str { 967 "place.wisp.fs" 968 } 969 fn def_name() -> &'static str { 970 "file" 971 } 972 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 973 lexicon_doc_place_wisp_fs() 974 } 975 fn validate( 976 &self, 977 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 978 Ok(()) 979 } 980} 981 982/// Virtual filesystem manifest for a Wisp site 983#[jacquard_derive::lexicon] 984#[derive( 985 serde::Serialize, 986 serde::Deserialize, 987 Debug, 988 Clone, 989 PartialEq, 990 Eq, 991 jacquard_derive::IntoStatic 992)] 993#[serde(rename_all = "camelCase")] 994pub struct Fs<'a> { 995 pub created_at: jacquard_common::types::string::Datetime, 996 #[serde(skip_serializing_if = "std::option::Option::is_none")] 997 pub file_count: Option<i64>, 998 #[serde(borrow)] 999 pub root: crate::place_wisp::fs::Directory<'a>, 1000 #[serde(borrow)] 1001 pub site: jacquard_common::CowStr<'a>, 1002} 1003 1004pub mod fs_state { 1005 1006 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 1007 #[allow(unused)] 1008 use ::core::marker::PhantomData; 1009 mod sealed { 1010 pub trait Sealed {} 1011 } 1012 /// State trait tracking which required fields have been set 1013 pub trait State: sealed::Sealed { 1014 type Site; 1015 type Root; 1016 type CreatedAt; 1017 } 1018 /// Empty state - all required fields are unset 1019 pub struct Empty(()); 1020 impl sealed::Sealed for Empty {} 1021 impl State for Empty { 1022 type Site = Unset; 1023 type Root = Unset; 1024 type CreatedAt = Unset; 1025 } 1026 ///State transition - sets the `site` field to Set 1027 pub struct SetSite<S: State = Empty>(PhantomData<fn() -> S>); 1028 impl<S: State> sealed::Sealed for SetSite<S> {} 1029 impl<S: State> State for SetSite<S> { 1030 type Site = Set<members::site>; 1031 type Root = S::Root; 1032 type CreatedAt = S::CreatedAt; 1033 } 1034 ///State transition - sets the `root` field to Set 1035 pub struct SetRoot<S: State = Empty>(PhantomData<fn() -> S>); 1036 impl<S: State> sealed::Sealed for SetRoot<S> {} 1037 impl<S: State> State for SetRoot<S> { 1038 type Site = S::Site; 1039 type Root = Set<members::root>; 1040 type CreatedAt = S::CreatedAt; 1041 } 1042 ///State transition - sets the `created_at` field to Set 1043 pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>); 1044 impl<S: State> sealed::Sealed for SetCreatedAt<S> {} 1045 impl<S: State> State for SetCreatedAt<S> { 1046 type Site = S::Site; 1047 type Root = S::Root; 1048 type CreatedAt = Set<members::created_at>; 1049 } 1050 /// Marker types for field names 1051 #[allow(non_camel_case_types)] 1052 pub mod members { 1053 ///Marker type for the `site` field 1054 pub struct site(()); 1055 ///Marker type for the `root` field 1056 pub struct root(()); 1057 ///Marker type for the `created_at` field 1058 pub struct created_at(()); 1059 } 1060} 1061 1062/// Builder for constructing an instance of this type 1063pub struct FsBuilder<'a, S: fs_state::State> { 1064 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 1065 __unsafe_private_named: ( 1066 ::core::option::Option<jacquard_common::types::string::Datetime>, 1067 ::core::option::Option<i64>, 1068 ::core::option::Option<crate::place_wisp::fs::Directory<'a>>, 1069 ::core::option::Option<jacquard_common::CowStr<'a>>, 1070 ), 1071 _phantom: ::core::marker::PhantomData<&'a ()>, 1072} 1073 1074impl<'a> Fs<'a> { 1075 /// Create a new builder for this type 1076 pub fn new() -> FsBuilder<'a, fs_state::Empty> { 1077 FsBuilder::new() 1078 } 1079} 1080 1081impl<'a> FsBuilder<'a, fs_state::Empty> { 1082 /// Create a new builder with all fields unset 1083 pub fn new() -> Self { 1084 FsBuilder { 1085 _phantom_state: ::core::marker::PhantomData, 1086 __unsafe_private_named: (None, None, None, None), 1087 _phantom: ::core::marker::PhantomData, 1088 } 1089 } 1090} 1091 1092impl<'a, S> FsBuilder<'a, S> 1093where 1094 S: fs_state::State, 1095 S::CreatedAt: fs_state::IsUnset, 1096{ 1097 /// Set the `createdAt` field (required) 1098 pub fn created_at( 1099 mut self, 1100 value: impl Into<jacquard_common::types::string::Datetime>, 1101 ) -> FsBuilder<'a, fs_state::SetCreatedAt<S>> { 1102 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); 1103 FsBuilder { 1104 _phantom_state: ::core::marker::PhantomData, 1105 __unsafe_private_named: self.__unsafe_private_named, 1106 _phantom: ::core::marker::PhantomData, 1107 } 1108 } 1109} 1110 1111impl<'a, S: fs_state::State> FsBuilder<'a, S> { 1112 /// Set the `fileCount` field (optional) 1113 pub fn file_count(mut self, value: impl Into<Option<i64>>) -> Self { 1114 self.__unsafe_private_named.1 = value.into(); 1115 self 1116 } 1117 /// Set the `fileCount` field to an Option value (optional) 1118 pub fn maybe_file_count(mut self, value: Option<i64>) -> Self { 1119 self.__unsafe_private_named.1 = value; 1120 self 1121 } 1122} 1123 1124impl<'a, S> FsBuilder<'a, S> 1125where 1126 S: fs_state::State, 1127 S::Root: fs_state::IsUnset, 1128{ 1129 /// Set the `root` field (required) 1130 pub fn root( 1131 mut self, 1132 value: impl Into<crate::place_wisp::fs::Directory<'a>>, 1133 ) -> FsBuilder<'a, fs_state::SetRoot<S>> { 1134 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); 1135 FsBuilder { 1136 _phantom_state: ::core::marker::PhantomData, 1137 __unsafe_private_named: self.__unsafe_private_named, 1138 _phantom: ::core::marker::PhantomData, 1139 } 1140 } 1141} 1142 1143impl<'a, S> FsBuilder<'a, S> 1144where 1145 S: fs_state::State, 1146 S::Site: fs_state::IsUnset, 1147{ 1148 /// Set the `site` field (required) 1149 pub fn site( 1150 mut self, 1151 value: impl Into<jacquard_common::CowStr<'a>>, 1152 ) -> FsBuilder<'a, fs_state::SetSite<S>> { 1153 self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); 1154 FsBuilder { 1155 _phantom_state: ::core::marker::PhantomData, 1156 __unsafe_private_named: self.__unsafe_private_named, 1157 _phantom: ::core::marker::PhantomData, 1158 } 1159 } 1160} 1161 1162impl<'a, S> FsBuilder<'a, S> 1163where 1164 S: fs_state::State, 1165 S::Site: fs_state::IsSet, 1166 S::Root: fs_state::IsSet, 1167 S::CreatedAt: fs_state::IsSet, 1168{ 1169 /// Build the final struct 1170 pub fn build(self) -> Fs<'a> { 1171 Fs { 1172 created_at: self.__unsafe_private_named.0.unwrap(), 1173 file_count: self.__unsafe_private_named.1, 1174 root: self.__unsafe_private_named.2.unwrap(), 1175 site: self.__unsafe_private_named.3.unwrap(), 1176 extra_data: Default::default(), 1177 } 1178 } 1179 /// Build the final struct with custom extra_data 1180 pub fn build_with_data( 1181 self, 1182 extra_data: std::collections::BTreeMap< 1183 jacquard_common::smol_str::SmolStr, 1184 jacquard_common::types::value::Data<'a>, 1185 >, 1186 ) -> Fs<'a> { 1187 Fs { 1188 created_at: self.__unsafe_private_named.0.unwrap(), 1189 file_count: self.__unsafe_private_named.1, 1190 root: self.__unsafe_private_named.2.unwrap(), 1191 site: self.__unsafe_private_named.3.unwrap(), 1192 extra_data: Some(extra_data), 1193 } 1194 } 1195} 1196 1197impl<'a> Fs<'a> { 1198 pub fn uri( 1199 uri: impl Into<jacquard_common::CowStr<'a>>, 1200 ) -> Result< 1201 jacquard_common::types::uri::RecordUri<'a, FsRecord>, 1202 jacquard_common::types::uri::UriError, 1203 > { 1204 jacquard_common::types::uri::RecordUri::try_from_uri( 1205 jacquard_common::types::string::AtUri::new_cow(uri.into())?, 1206 ) 1207 } 1208} 1209 1210/// Typed wrapper for GetRecord response with this collection's record type. 1211#[derive( 1212 serde::Serialize, 1213 serde::Deserialize, 1214 Debug, 1215 Clone, 1216 PartialEq, 1217 Eq, 1218 jacquard_derive::IntoStatic 1219)] 1220#[serde(rename_all = "camelCase")] 1221pub struct FsGetRecordOutput<'a> { 1222 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1223 #[serde(borrow)] 1224 pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>, 1225 #[serde(borrow)] 1226 pub uri: jacquard_common::types::string::AtUri<'a>, 1227 #[serde(borrow)] 1228 pub value: Fs<'a>, 1229} 1230 1231impl From<FsGetRecordOutput<'_>> for Fs<'_> { 1232 fn from(output: FsGetRecordOutput<'_>) -> Self { 1233 use jacquard_common::IntoStatic; 1234 output.value.into_static() 1235 } 1236} 1237 1238impl jacquard_common::types::collection::Collection for Fs<'_> { 1239 const NSID: &'static str = "place.wisp.fs"; 1240 type Record = FsRecord; 1241} 1242 1243/// Marker type for deserializing records from this collection. 1244#[derive(Debug, serde::Serialize, serde::Deserialize)] 1245pub struct FsRecord; 1246impl jacquard_common::xrpc::XrpcResp for FsRecord { 1247 const NSID: &'static str = "place.wisp.fs"; 1248 const ENCODING: &'static str = "application/json"; 1249 type Output<'de> = FsGetRecordOutput<'de>; 1250 type Err<'de> = jacquard_common::types::collection::RecordError<'de>; 1251} 1252 1253impl jacquard_common::types::collection::Collection for FsRecord { 1254 const NSID: &'static str = "place.wisp.fs"; 1255 type Record = FsRecord; 1256} 1257 1258impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Fs<'a> { 1259 fn nsid() -> &'static str { 1260 "place.wisp.fs" 1261 } 1262 fn def_name() -> &'static str { 1263 "main" 1264 } 1265 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 1266 lexicon_doc_place_wisp_fs() 1267 } 1268 fn validate( 1269 &self, 1270 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 1271 if let Some(ref value) = self.file_count { 1272 if *value > 1000i64 { 1273 return Err(::jacquard_lexicon::validation::ConstraintError::Maximum { 1274 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 1275 "file_count", 1276 ), 1277 max: 1000i64, 1278 actual: *value, 1279 }); 1280 } 1281 } 1282 if let Some(ref value) = self.file_count { 1283 if *value < 0i64 { 1284 return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { 1285 path: ::jacquard_lexicon::validation::ValidationPath::from_field( 1286 "file_count", 1287 ), 1288 min: 0i64, 1289 actual: *value, 1290 }); 1291 } 1292 } 1293 Ok(()) 1294 } 1295} 1296 1297#[jacquard_derive::lexicon] 1298#[derive( 1299 serde::Serialize, 1300 serde::Deserialize, 1301 Debug, 1302 Clone, 1303 PartialEq, 1304 Eq, 1305 jacquard_derive::IntoStatic 1306)] 1307#[serde(rename_all = "camelCase")] 1308pub struct Subfs<'a> { 1309 /// If true, the subfs record's root entries are merged (flattened) into the parent directory, replacing the subfs entry. If false (default), the subfs entries are placed in a subdirectory with the subfs entry's name. Flat merging is useful for splitting large directories across multiple records while maintaining a flat structure. 1310 #[serde(skip_serializing_if = "std::option::Option::is_none")] 1311 pub flat: Option<bool>, 1312 /// AT-URI pointing to a place.wisp.subfs record containing this subtree. 1313 #[serde(borrow)] 1314 pub subject: jacquard_common::types::string::AtUri<'a>, 1315 #[serde(borrow)] 1316 pub r#type: jacquard_common::CowStr<'a>, 1317} 1318 1319pub mod subfs_state { 1320 1321 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; 1322 #[allow(unused)] 1323 use ::core::marker::PhantomData; 1324 mod sealed { 1325 pub trait Sealed {} 1326 } 1327 /// State trait tracking which required fields have been set 1328 pub trait State: sealed::Sealed { 1329 type Type; 1330 type Subject; 1331 } 1332 /// Empty state - all required fields are unset 1333 pub struct Empty(()); 1334 impl sealed::Sealed for Empty {} 1335 impl State for Empty { 1336 type Type = Unset; 1337 type Subject = Unset; 1338 } 1339 ///State transition - sets the `type` field to Set 1340 pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>); 1341 impl<S: State> sealed::Sealed for SetType<S> {} 1342 impl<S: State> State for SetType<S> { 1343 type Type = Set<members::r#type>; 1344 type Subject = S::Subject; 1345 } 1346 ///State transition - sets the `subject` field to Set 1347 pub struct SetSubject<S: State = Empty>(PhantomData<fn() -> S>); 1348 impl<S: State> sealed::Sealed for SetSubject<S> {} 1349 impl<S: State> State for SetSubject<S> { 1350 type Type = S::Type; 1351 type Subject = Set<members::subject>; 1352 } 1353 /// Marker types for field names 1354 #[allow(non_camel_case_types)] 1355 pub mod members { 1356 ///Marker type for the `type` field 1357 pub struct r#type(()); 1358 ///Marker type for the `subject` field 1359 pub struct subject(()); 1360 } 1361} 1362 1363/// Builder for constructing an instance of this type 1364pub struct SubfsBuilder<'a, S: subfs_state::State> { 1365 _phantom_state: ::core::marker::PhantomData<fn() -> S>, 1366 __unsafe_private_named: ( 1367 ::core::option::Option<bool>, 1368 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>, 1369 ::core::option::Option<jacquard_common::CowStr<'a>>, 1370 ), 1371 _phantom: ::core::marker::PhantomData<&'a ()>, 1372} 1373 1374impl<'a> Subfs<'a> { 1375 /// Create a new builder for this type 1376 pub fn new() -> SubfsBuilder<'a, subfs_state::Empty> { 1377 SubfsBuilder::new() 1378 } 1379} 1380 1381impl<'a> SubfsBuilder<'a, subfs_state::Empty> { 1382 /// Create a new builder with all fields unset 1383 pub fn new() -> Self { 1384 SubfsBuilder { 1385 _phantom_state: ::core::marker::PhantomData, 1386 __unsafe_private_named: (None, None, None), 1387 _phantom: ::core::marker::PhantomData, 1388 } 1389 } 1390} 1391 1392impl<'a, S: subfs_state::State> SubfsBuilder<'a, S> { 1393 /// Set the `flat` field (optional) 1394 pub fn flat(mut self, value: impl Into<Option<bool>>) -> Self { 1395 self.__unsafe_private_named.0 = value.into(); 1396 self 1397 } 1398 /// Set the `flat` field to an Option value (optional) 1399 pub fn maybe_flat(mut self, value: Option<bool>) -> Self { 1400 self.__unsafe_private_named.0 = value; 1401 self 1402 } 1403} 1404 1405impl<'a, S> SubfsBuilder<'a, S> 1406where 1407 S: subfs_state::State, 1408 S::Subject: subfs_state::IsUnset, 1409{ 1410 /// Set the `subject` field (required) 1411 pub fn subject( 1412 mut self, 1413 value: impl Into<jacquard_common::types::string::AtUri<'a>>, 1414 ) -> SubfsBuilder<'a, subfs_state::SetSubject<S>> { 1415 self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); 1416 SubfsBuilder { 1417 _phantom_state: ::core::marker::PhantomData, 1418 __unsafe_private_named: self.__unsafe_private_named, 1419 _phantom: ::core::marker::PhantomData, 1420 } 1421 } 1422} 1423 1424impl<'a, S> SubfsBuilder<'a, S> 1425where 1426 S: subfs_state::State, 1427 S::Type: subfs_state::IsUnset, 1428{ 1429 /// Set the `type` field (required) 1430 pub fn r#type( 1431 mut self, 1432 value: impl Into<jacquard_common::CowStr<'a>>, 1433 ) -> SubfsBuilder<'a, subfs_state::SetType<S>> { 1434 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); 1435 SubfsBuilder { 1436 _phantom_state: ::core::marker::PhantomData, 1437 __unsafe_private_named: self.__unsafe_private_named, 1438 _phantom: ::core::marker::PhantomData, 1439 } 1440 } 1441} 1442 1443impl<'a, S> SubfsBuilder<'a, S> 1444where 1445 S: subfs_state::State, 1446 S::Type: subfs_state::IsSet, 1447 S::Subject: subfs_state::IsSet, 1448{ 1449 /// Build the final struct 1450 pub fn build(self) -> Subfs<'a> { 1451 Subfs { 1452 flat: self.__unsafe_private_named.0, 1453 subject: self.__unsafe_private_named.1.unwrap(), 1454 r#type: self.__unsafe_private_named.2.unwrap(), 1455 extra_data: Default::default(), 1456 } 1457 } 1458 /// Build the final struct with custom extra_data 1459 pub fn build_with_data( 1460 self, 1461 extra_data: std::collections::BTreeMap< 1462 jacquard_common::smol_str::SmolStr, 1463 jacquard_common::types::value::Data<'a>, 1464 >, 1465 ) -> Subfs<'a> { 1466 Subfs { 1467 flat: self.__unsafe_private_named.0, 1468 subject: self.__unsafe_private_named.1.unwrap(), 1469 r#type: self.__unsafe_private_named.2.unwrap(), 1470 extra_data: Some(extra_data), 1471 } 1472 } 1473} 1474 1475impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Subfs<'a> { 1476 fn nsid() -> &'static str { 1477 "place.wisp.fs" 1478 } 1479 fn def_name() -> &'static str { 1480 "subfs" 1481 } 1482 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { 1483 lexicon_doc_place_wisp_fs() 1484 } 1485 fn validate( 1486 &self, 1487 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { 1488 Ok(()) 1489 } 1490}