// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: sh.weaver.domain.defs // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. pub mod generate_document; pub mod resolve_by_domain; pub mod resolve_document; /// Hydrated view of a document with re-hydrated content. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct DocumentView<'a> { #[serde(borrow)] pub cid: jacquard_common::types::string::Cid<'a>, #[serde(borrow)] pub did: jacquard_common::types::string::Did<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] pub entry_index: std::option::Option, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub entry_uri: std::option::Option>, pub indexed_at: jacquard_common::types::string::Datetime, #[serde(borrow)] pub path: jacquard_common::CowStr<'a>, #[serde(borrow)] pub record: jacquard_common::types::value::Data<'a>, #[serde(borrow)] pub rkey: jacquard_common::CowStr<'a>, #[serde(borrow)] pub title: jacquard_common::CowStr<'a>, #[serde(borrow)] pub uri: jacquard_common::types::string::AtUri<'a>, } pub mod document_view_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type Cid; type Uri; type Rkey; type IndexedAt; type Record; type Title; type Path; type Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Cid = Unset; type Uri = Unset; type Rkey = Unset; type IndexedAt = Unset; type Record = Unset; type Title = Unset; type Path = Unset; type Did = Unset; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { type Cid = Set; type Uri = S::Uri; type Rkey = S::Rkey; type IndexedAt = S::IndexedAt; type Record = S::Record; type Title = S::Title; type Path = S::Path; type Did = S::Did; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { type Cid = S::Cid; type Uri = Set; type Rkey = S::Rkey; type IndexedAt = S::IndexedAt; type Record = S::Record; type Title = S::Title; type Path = S::Path; type Did = S::Did; } ///State transition - sets the `rkey` field to Set pub struct SetRkey(PhantomData S>); impl sealed::Sealed for SetRkey {} impl State for SetRkey { type Cid = S::Cid; type Uri = S::Uri; type Rkey = Set; type IndexedAt = S::IndexedAt; type Record = S::Record; type Title = S::Title; type Path = S::Path; type Did = S::Did; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt(PhantomData S>); impl sealed::Sealed for SetIndexedAt {} impl State for SetIndexedAt { type Cid = S::Cid; type Uri = S::Uri; type Rkey = S::Rkey; type IndexedAt = Set; type Record = S::Record; type Title = S::Title; type Path = S::Path; type Did = S::Did; } ///State transition - sets the `record` field to Set pub struct SetRecord(PhantomData S>); impl sealed::Sealed for SetRecord {} impl State for SetRecord { type Cid = S::Cid; type Uri = S::Uri; type Rkey = S::Rkey; type IndexedAt = S::IndexedAt; type Record = Set; type Title = S::Title; type Path = S::Path; type Did = S::Did; } ///State transition - sets the `title` field to Set pub struct SetTitle(PhantomData S>); impl sealed::Sealed for SetTitle {} impl State for SetTitle { type Cid = S::Cid; type Uri = S::Uri; type Rkey = S::Rkey; type IndexedAt = S::IndexedAt; type Record = S::Record; type Title = Set; type Path = S::Path; type Did = S::Did; } ///State transition - sets the `path` field to Set pub struct SetPath(PhantomData S>); impl sealed::Sealed for SetPath {} impl State for SetPath { type Cid = S::Cid; type Uri = S::Uri; type Rkey = S::Rkey; type IndexedAt = S::IndexedAt; type Record = S::Record; type Title = S::Title; type Path = Set; type Did = S::Did; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { type Cid = S::Cid; type Uri = S::Uri; type Rkey = S::Rkey; type IndexedAt = S::IndexedAt; type Record = S::Record; type Title = S::Title; type Path = S::Path; type Did = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `cid` field pub struct cid(()); ///Marker type for the `uri` field pub struct uri(()); ///Marker type for the `rkey` field pub struct rkey(()); ///Marker type for the `indexed_at` field pub struct indexed_at(()); ///Marker type for the `record` field pub struct record(()); ///Marker type for the `title` field pub struct title(()); ///Marker type for the `path` field pub struct path(()); ///Marker type for the `did` field pub struct did(()); } } /// Builder for constructing an instance of this type pub struct DocumentViewBuilder<'a, S: document_view_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> DocumentView<'a> { /// Create a new builder for this type pub fn new() -> DocumentViewBuilder<'a, document_view_state::Empty> { DocumentViewBuilder::new() } } impl<'a> DocumentViewBuilder<'a, document_view_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { DocumentViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: ( None, None, None, None, None, None, None, None, None, None, ), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> DocumentViewBuilder<'a, S> where S: document_view_state::State, S::Cid: document_view_state::IsUnset, { /// Set the `cid` field (required) pub fn cid( mut self, value: impl Into>, ) -> DocumentViewBuilder<'a, document_view_state::SetCid> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); DocumentViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> DocumentViewBuilder<'a, S> where S: document_view_state::State, S::Did: document_view_state::IsUnset, { /// Set the `did` field (required) pub fn did( mut self, value: impl Into>, ) -> DocumentViewBuilder<'a, document_view_state::SetDid> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); DocumentViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: document_view_state::State> DocumentViewBuilder<'a, S> { /// Set the `entryIndex` field (optional) pub fn entry_index(mut self, value: impl Into>) -> Self { self.__unsafe_private_named.2 = value.into(); self } /// Set the `entryIndex` field to an Option value (optional) pub fn maybe_entry_index(mut self, value: Option) -> Self { self.__unsafe_private_named.2 = value; self } } impl<'a, S: document_view_state::State> DocumentViewBuilder<'a, S> { /// Set the `entryUri` field (optional) pub fn entry_uri( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.3 = value.into(); self } /// Set the `entryUri` field to an Option value (optional) pub fn maybe_entry_uri( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.3 = value; self } } impl<'a, S> DocumentViewBuilder<'a, S> where S: document_view_state::State, S::IndexedAt: document_view_state::IsUnset, { /// Set the `indexedAt` field (required) pub fn indexed_at( mut self, value: impl Into, ) -> DocumentViewBuilder<'a, document_view_state::SetIndexedAt> { self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); DocumentViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> DocumentViewBuilder<'a, S> where S: document_view_state::State, S::Path: document_view_state::IsUnset, { /// Set the `path` field (required) pub fn path( mut self, value: impl Into>, ) -> DocumentViewBuilder<'a, document_view_state::SetPath> { self.__unsafe_private_named.5 = ::core::option::Option::Some(value.into()); DocumentViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> DocumentViewBuilder<'a, S> where S: document_view_state::State, S::Record: document_view_state::IsUnset, { /// Set the `record` field (required) pub fn record( mut self, value: impl Into>, ) -> DocumentViewBuilder<'a, document_view_state::SetRecord> { self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into()); DocumentViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> DocumentViewBuilder<'a, S> where S: document_view_state::State, S::Rkey: document_view_state::IsUnset, { /// Set the `rkey` field (required) pub fn rkey( mut self, value: impl Into>, ) -> DocumentViewBuilder<'a, document_view_state::SetRkey> { self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into()); DocumentViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> DocumentViewBuilder<'a, S> where S: document_view_state::State, S::Title: document_view_state::IsUnset, { /// Set the `title` field (required) pub fn title( mut self, value: impl Into>, ) -> DocumentViewBuilder<'a, document_view_state::SetTitle> { self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into()); DocumentViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> DocumentViewBuilder<'a, S> where S: document_view_state::State, S::Uri: document_view_state::IsUnset, { /// Set the `uri` field (required) pub fn uri( mut self, value: impl Into>, ) -> DocumentViewBuilder<'a, document_view_state::SetUri> { self.__unsafe_private_named.9 = ::core::option::Option::Some(value.into()); DocumentViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> DocumentViewBuilder<'a, S> where S: document_view_state::State, S::Cid: document_view_state::IsSet, S::Uri: document_view_state::IsSet, S::Rkey: document_view_state::IsSet, S::IndexedAt: document_view_state::IsSet, S::Record: document_view_state::IsSet, S::Title: document_view_state::IsSet, S::Path: document_view_state::IsSet, S::Did: document_view_state::IsSet, { /// Build the final struct pub fn build(self) -> DocumentView<'a> { DocumentView { cid: self.__unsafe_private_named.0.unwrap(), did: self.__unsafe_private_named.1.unwrap(), entry_index: self.__unsafe_private_named.2, entry_uri: self.__unsafe_private_named.3, indexed_at: self.__unsafe_private_named.4.unwrap(), path: self.__unsafe_private_named.5.unwrap(), record: self.__unsafe_private_named.6.unwrap(), rkey: self.__unsafe_private_named.7.unwrap(), title: self.__unsafe_private_named.8.unwrap(), uri: self.__unsafe_private_named.9.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> DocumentView<'a> { DocumentView { cid: self.__unsafe_private_named.0.unwrap(), did: self.__unsafe_private_named.1.unwrap(), entry_index: self.__unsafe_private_named.2, entry_uri: self.__unsafe_private_named.3, indexed_at: self.__unsafe_private_named.4.unwrap(), path: self.__unsafe_private_named.5.unwrap(), record: self.__unsafe_private_named.6.unwrap(), rkey: self.__unsafe_private_named.7.unwrap(), title: self.__unsafe_private_named.8.unwrap(), uri: self.__unsafe_private_named.9.unwrap(), extra_data: Some(extra_data), } } } fn lexicon_doc_sh_weaver_domain_defs() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("sh.weaver.domain.defs"), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("documentView"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Hydrated view of a document with re-hydrated content.", ), ), required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_common::smol_str::SmolStr::new_static("rkey"), ::jacquard_common::smol_str::SmolStr::new_static("title"), ::jacquard_common::smol_str::SmolStr::new_static("path"), ::jacquard_common::smol_str::SmolStr::new_static("record"), ::jacquard_common::smol_str::SmolStr::new_static("indexedAt") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Cid, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Did, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "entryIndex", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("entryUri"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "indexedAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("path"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("record"), ::jacquard_lexicon::lexicon::LexObjectProperty::Unknown(::jacquard_lexicon::lexicon::LexUnknown { description: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("rkey"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("title"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("publicationView"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Hydrated view of a publication with domain info.", ), ), required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_common::smol_str::SmolStr::new_static("rkey"), ::jacquard_common::smol_str::SmolStr::new_static("name"), ::jacquard_common::smol_str::SmolStr::new_static("domain"), ::jacquard_common::smol_str::SmolStr::new_static("record"), ::jacquard_common::smol_str::SmolStr::new_static("indexedAt") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cid"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Cid, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("did"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Did, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("domain"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "indexedAt", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Datetime, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("name"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "notebookUri", ), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("record"), ::jacquard_lexicon::lexicon::LexObjectProperty::Unknown(::jacquard_lexicon::lexicon::LexUnknown { description: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("rkey"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: None, default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::AtUri, ), default: None, min_length: None, max_length: None, min_graphemes: None, max_graphemes: None, r#enum: None, r#const: None, known_values: None, }), ); map }, }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for DocumentView<'a> { fn nsid() -> &'static str { "sh.weaver.domain.defs" } fn def_name() -> &'static str { "documentView" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_domain_defs() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Hydrated view of a publication with domain info. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct PublicationView<'a> { #[serde(borrow)] pub cid: jacquard_common::types::string::Cid<'a>, #[serde(borrow)] pub did: jacquard_common::types::string::Did<'a>, #[serde(borrow)] pub domain: jacquard_common::CowStr<'a>, pub indexed_at: jacquard_common::types::string::Datetime, #[serde(borrow)] pub name: jacquard_common::CowStr<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub notebook_uri: std::option::Option>, #[serde(borrow)] pub record: jacquard_common::types::value::Data<'a>, #[serde(borrow)] pub rkey: jacquard_common::CowStr<'a>, #[serde(borrow)] pub uri: jacquard_common::types::string::AtUri<'a>, } pub mod publication_view_state { pub use crate::builder_types::{Set, Unset, IsSet, IsUnset}; #[allow(unused)] use ::core::marker::PhantomData; mod sealed { pub trait Sealed {} } /// State trait tracking which required fields have been set pub trait State: sealed::Sealed { type IndexedAt; type Uri; type Name; type Did; type Cid; type Rkey; type Record; type Domain; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type IndexedAt = Unset; type Uri = Unset; type Name = Unset; type Did = Unset; type Cid = Unset; type Rkey = Unset; type Record = Unset; type Domain = Unset; } ///State transition - sets the `indexed_at` field to Set pub struct SetIndexedAt(PhantomData S>); impl sealed::Sealed for SetIndexedAt {} impl State for SetIndexedAt { type IndexedAt = Set; type Uri = S::Uri; type Name = S::Name; type Did = S::Did; type Cid = S::Cid; type Rkey = S::Rkey; type Record = S::Record; type Domain = S::Domain; } ///State transition - sets the `uri` field to Set pub struct SetUri(PhantomData S>); impl sealed::Sealed for SetUri {} impl State for SetUri { type IndexedAt = S::IndexedAt; type Uri = Set; type Name = S::Name; type Did = S::Did; type Cid = S::Cid; type Rkey = S::Rkey; type Record = S::Record; type Domain = S::Domain; } ///State transition - sets the `name` field to Set pub struct SetName(PhantomData S>); impl sealed::Sealed for SetName {} impl State for SetName { type IndexedAt = S::IndexedAt; type Uri = S::Uri; type Name = Set; type Did = S::Did; type Cid = S::Cid; type Rkey = S::Rkey; type Record = S::Record; type Domain = S::Domain; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { type IndexedAt = S::IndexedAt; type Uri = S::Uri; type Name = S::Name; type Did = Set; type Cid = S::Cid; type Rkey = S::Rkey; type Record = S::Record; type Domain = S::Domain; } ///State transition - sets the `cid` field to Set pub struct SetCid(PhantomData S>); impl sealed::Sealed for SetCid {} impl State for SetCid { type IndexedAt = S::IndexedAt; type Uri = S::Uri; type Name = S::Name; type Did = S::Did; type Cid = Set; type Rkey = S::Rkey; type Record = S::Record; type Domain = S::Domain; } ///State transition - sets the `rkey` field to Set pub struct SetRkey(PhantomData S>); impl sealed::Sealed for SetRkey {} impl State for SetRkey { type IndexedAt = S::IndexedAt; type Uri = S::Uri; type Name = S::Name; type Did = S::Did; type Cid = S::Cid; type Rkey = Set; type Record = S::Record; type Domain = S::Domain; } ///State transition - sets the `record` field to Set pub struct SetRecord(PhantomData S>); impl sealed::Sealed for SetRecord {} impl State for SetRecord { type IndexedAt = S::IndexedAt; type Uri = S::Uri; type Name = S::Name; type Did = S::Did; type Cid = S::Cid; type Rkey = S::Rkey; type Record = Set; type Domain = S::Domain; } ///State transition - sets the `domain` field to Set pub struct SetDomain(PhantomData S>); impl sealed::Sealed for SetDomain {} impl State for SetDomain { type IndexedAt = S::IndexedAt; type Uri = S::Uri; type Name = S::Name; type Did = S::Did; type Cid = S::Cid; type Rkey = S::Rkey; type Record = S::Record; type Domain = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `indexed_at` field pub struct indexed_at(()); ///Marker type for the `uri` field pub struct uri(()); ///Marker type for the `name` field pub struct name(()); ///Marker type for the `did` field pub struct did(()); ///Marker type for the `cid` field pub struct cid(()); ///Marker type for the `rkey` field pub struct rkey(()); ///Marker type for the `record` field pub struct record(()); ///Marker type for the `domain` field pub struct domain(()); } } /// Builder for constructing an instance of this type pub struct PublicationViewBuilder<'a, S: publication_view_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> PublicationView<'a> { /// Create a new builder for this type pub fn new() -> PublicationViewBuilder<'a, publication_view_state::Empty> { PublicationViewBuilder::new() } } impl<'a> PublicationViewBuilder<'a, publication_view_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { PublicationViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: ( None, None, None, None, None, None, None, None, None, ), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> PublicationViewBuilder<'a, S> where S: publication_view_state::State, S::Cid: publication_view_state::IsUnset, { /// Set the `cid` field (required) pub fn cid( mut self, value: impl Into>, ) -> PublicationViewBuilder<'a, publication_view_state::SetCid> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); PublicationViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> PublicationViewBuilder<'a, S> where S: publication_view_state::State, S::Did: publication_view_state::IsUnset, { /// Set the `did` field (required) pub fn did( mut self, value: impl Into>, ) -> PublicationViewBuilder<'a, publication_view_state::SetDid> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); PublicationViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> PublicationViewBuilder<'a, S> where S: publication_view_state::State, S::Domain: publication_view_state::IsUnset, { /// Set the `domain` field (required) pub fn domain( mut self, value: impl Into>, ) -> PublicationViewBuilder<'a, publication_view_state::SetDomain> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); PublicationViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> PublicationViewBuilder<'a, S> where S: publication_view_state::State, S::IndexedAt: publication_view_state::IsUnset, { /// Set the `indexedAt` field (required) pub fn indexed_at( mut self, value: impl Into, ) -> PublicationViewBuilder<'a, publication_view_state::SetIndexedAt> { self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into()); PublicationViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> PublicationViewBuilder<'a, S> where S: publication_view_state::State, S::Name: publication_view_state::IsUnset, { /// Set the `name` field (required) pub fn name( mut self, value: impl Into>, ) -> PublicationViewBuilder<'a, publication_view_state::SetName> { self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into()); PublicationViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: publication_view_state::State> PublicationViewBuilder<'a, S> { /// Set the `notebookUri` field (optional) pub fn notebook_uri( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.5 = value.into(); self } /// Set the `notebookUri` field to an Option value (optional) pub fn maybe_notebook_uri( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.5 = value; self } } impl<'a, S> PublicationViewBuilder<'a, S> where S: publication_view_state::State, S::Record: publication_view_state::IsUnset, { /// Set the `record` field (required) pub fn record( mut self, value: impl Into>, ) -> PublicationViewBuilder<'a, publication_view_state::SetRecord> { self.__unsafe_private_named.6 = ::core::option::Option::Some(value.into()); PublicationViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> PublicationViewBuilder<'a, S> where S: publication_view_state::State, S::Rkey: publication_view_state::IsUnset, { /// Set the `rkey` field (required) pub fn rkey( mut self, value: impl Into>, ) -> PublicationViewBuilder<'a, publication_view_state::SetRkey> { self.__unsafe_private_named.7 = ::core::option::Option::Some(value.into()); PublicationViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> PublicationViewBuilder<'a, S> where S: publication_view_state::State, S::Uri: publication_view_state::IsUnset, { /// Set the `uri` field (required) pub fn uri( mut self, value: impl Into>, ) -> PublicationViewBuilder<'a, publication_view_state::SetUri> { self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into()); PublicationViewBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> PublicationViewBuilder<'a, S> where S: publication_view_state::State, S::IndexedAt: publication_view_state::IsSet, S::Uri: publication_view_state::IsSet, S::Name: publication_view_state::IsSet, S::Did: publication_view_state::IsSet, S::Cid: publication_view_state::IsSet, S::Rkey: publication_view_state::IsSet, S::Record: publication_view_state::IsSet, S::Domain: publication_view_state::IsSet, { /// Build the final struct pub fn build(self) -> PublicationView<'a> { PublicationView { cid: self.__unsafe_private_named.0.unwrap(), did: self.__unsafe_private_named.1.unwrap(), domain: self.__unsafe_private_named.2.unwrap(), indexed_at: self.__unsafe_private_named.3.unwrap(), name: self.__unsafe_private_named.4.unwrap(), notebook_uri: self.__unsafe_private_named.5, record: self.__unsafe_private_named.6.unwrap(), rkey: self.__unsafe_private_named.7.unwrap(), uri: self.__unsafe_private_named.8.unwrap(), extra_data: Default::default(), } } /// Build the final struct with custom extra_data pub fn build_with_data( self, extra_data: std::collections::BTreeMap< jacquard_common::smol_str::SmolStr, jacquard_common::types::value::Data<'a>, >, ) -> PublicationView<'a> { PublicationView { cid: self.__unsafe_private_named.0.unwrap(), did: self.__unsafe_private_named.1.unwrap(), domain: self.__unsafe_private_named.2.unwrap(), indexed_at: self.__unsafe_private_named.3.unwrap(), name: self.__unsafe_private_named.4.unwrap(), notebook_uri: self.__unsafe_private_named.5, record: self.__unsafe_private_named.6.unwrap(), rkey: self.__unsafe_private_named.7.unwrap(), uri: self.__unsafe_private_named.8.unwrap(), extra_data: Some(extra_data), } } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for PublicationView<'a> { fn nsid() -> &'static str { "sh.weaver.domain.defs" } fn def_name() -> &'static str { "publicationView" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_domain_defs() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } }