// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: pub.leaflet.richtext.facet // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. /// Facet feature for mentioning an AT URI. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct AtMention<'a> { #[serde(borrow)] pub at_uri: jacquard_common::types::string::Uri<'a>, } pub mod at_mention_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 AtUri; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type AtUri = Unset; } ///State transition - sets the `at_uri` field to Set pub struct SetAtUri(PhantomData S>); impl sealed::Sealed for SetAtUri {} impl State for SetAtUri { type AtUri = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `at_uri` field pub struct at_uri(()); } } /// Builder for constructing an instance of this type pub struct AtMentionBuilder<'a, S: at_mention_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> AtMention<'a> { /// Create a new builder for this type pub fn new() -> AtMentionBuilder<'a, at_mention_state::Empty> { AtMentionBuilder::new() } } impl<'a> AtMentionBuilder<'a, at_mention_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { AtMentionBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None,), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> AtMentionBuilder<'a, S> where S: at_mention_state::State, S::AtUri: at_mention_state::IsUnset, { /// Set the `atURI` field (required) pub fn at_uri( mut self, value: impl Into>, ) -> AtMentionBuilder<'a, at_mention_state::SetAtUri> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); AtMentionBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> AtMentionBuilder<'a, S> where S: at_mention_state::State, S::AtUri: at_mention_state::IsSet, { /// Build the final struct pub fn build(self) -> AtMention<'a> { AtMention { at_uri: self.__unsafe_private_named.0.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>, >, ) -> AtMention<'a> { AtMention { at_uri: self.__unsafe_private_named.0.unwrap(), extra_data: Some(extra_data), } } } fn lexicon_doc_pub_leaflet_richtext_facet() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("pub.leaflet.richtext.facet"), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("atMention"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Facet feature for mentioning an AT URI.", ), ), required: Some( vec![::jacquard_common::smol_str::SmolStr::new_static("atURI")], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("atURI"), ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString { description: None, format: Some( ::jacquard_lexicon::lexicon::LexStringFormat::Uri, ), 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("bold"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Facet feature for bold text", ), ), required: Some(vec![]), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("byteSlice"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets.", ), ), required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("byteStart"), ::jacquard_common::smol_str::SmolStr::new_static("byteEnd") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("byteEnd"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: Some(0i64), maximum: None, r#enum: None, r#const: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "byteStart", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: Some(0i64), maximum: None, r#enum: None, r#const: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("code"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Facet feature for inline code.", ), ), required: Some(vec![]), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("didMention"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Facet feature for mentioning a did.", ), ), required: Some( vec![::jacquard_common::smol_str::SmolStr::new_static("did")], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); 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 }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("highlight"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Facet feature for highlighted text.", ), ), required: Some(vec![]), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("id"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Facet feature for an identifier. Used for linking to a segment", ), ), required: Some(vec![]), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("id"), ::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 }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("italic"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Facet feature for italic text", ), ), required: Some(vec![]), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("link"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL.", ), ), required: Some( vec![::jacquard_common::smol_str::SmolStr::new_static("uri")], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("uri"), ::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 }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Annotation of a sub-string within rich text.", ), ), required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("index"), ::jacquard_common::smol_str::SmolStr::new_static("features") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("features"), ::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray { description: None, items: ::jacquard_lexicon::lexicon::LexArrayItem::Union(::jacquard_lexicon::lexicon::LexRefUnion { description: None, refs: vec![ ::jacquard_common::CowStr::new_static("#link"), ::jacquard_common::CowStr::new_static("#didMention"), ::jacquard_common::CowStr::new_static("#atMention"), ::jacquard_common::CowStr::new_static("#code"), ::jacquard_common::CowStr::new_static("#highlight"), ::jacquard_common::CowStr::new_static("#underline"), ::jacquard_common::CowStr::new_static("#strikethrough"), ::jacquard_common::CowStr::new_static("#id"), ::jacquard_common::CowStr::new_static("#bold"), ::jacquard_common::CowStr::new_static("#italic") ], closed: None, }), min_length: None, max_length: None, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("index"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static("#byteSlice"), }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("strikethrough"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Facet feature for strikethrough markup", ), ), required: Some(vec![]), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("underline"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: Some( ::jacquard_common::CowStr::new_static( "Facet feature for underline markup", ), ), required: Some(vec![]), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map }, }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for AtMention<'a> { fn nsid() -> &'static str { "pub.leaflet.richtext.facet" } fn def_name() -> &'static str { "atMention" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_pub_leaflet_richtext_facet() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Facet feature for bold text #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, Default )] #[serde(rename_all = "camelCase")] pub struct Bold<'a> {} impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Bold<'a> { fn nsid() -> &'static str { "pub.leaflet.richtext.facet" } fn def_name() -> &'static str { "bold" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_pub_leaflet_richtext_facet() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct ByteSlice<'a> { pub byte_end: i64, pub byte_start: i64, } pub mod byte_slice_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 ByteEnd; type ByteStart; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type ByteEnd = Unset; type ByteStart = Unset; } ///State transition - sets the `byte_end` field to Set pub struct SetByteEnd(PhantomData S>); impl sealed::Sealed for SetByteEnd {} impl State for SetByteEnd { type ByteEnd = Set; type ByteStart = S::ByteStart; } ///State transition - sets the `byte_start` field to Set pub struct SetByteStart(PhantomData S>); impl sealed::Sealed for SetByteStart {} impl State for SetByteStart { type ByteEnd = S::ByteEnd; type ByteStart = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `byte_end` field pub struct byte_end(()); ///Marker type for the `byte_start` field pub struct byte_start(()); } } /// Builder for constructing an instance of this type pub struct ByteSliceBuilder<'a, S: byte_slice_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: (::core::option::Option, ::core::option::Option), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> ByteSlice<'a> { /// Create a new builder for this type pub fn new() -> ByteSliceBuilder<'a, byte_slice_state::Empty> { ByteSliceBuilder::new() } } impl<'a> ByteSliceBuilder<'a, byte_slice_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { ByteSliceBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ByteSliceBuilder<'a, S> where S: byte_slice_state::State, S::ByteEnd: byte_slice_state::IsUnset, { /// Set the `byteEnd` field (required) pub fn byte_end( mut self, value: impl Into, ) -> ByteSliceBuilder<'a, byte_slice_state::SetByteEnd> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); ByteSliceBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ByteSliceBuilder<'a, S> where S: byte_slice_state::State, S::ByteStart: byte_slice_state::IsUnset, { /// Set the `byteStart` field (required) pub fn byte_start( mut self, value: impl Into, ) -> ByteSliceBuilder<'a, byte_slice_state::SetByteStart> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); ByteSliceBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ByteSliceBuilder<'a, S> where S: byte_slice_state::State, S::ByteEnd: byte_slice_state::IsSet, S::ByteStart: byte_slice_state::IsSet, { /// Build the final struct pub fn build(self) -> ByteSlice<'a> { ByteSlice { byte_end: self.__unsafe_private_named.0.unwrap(), byte_start: self.__unsafe_private_named.1.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>, >, ) -> ByteSlice<'a> { ByteSlice { byte_end: self.__unsafe_private_named.0.unwrap(), byte_start: self.__unsafe_private_named.1.unwrap(), extra_data: Some(extra_data), } } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ByteSlice<'a> { fn nsid() -> &'static str { "pub.leaflet.richtext.facet" } fn def_name() -> &'static str { "byteSlice" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_pub_leaflet_richtext_facet() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { { let value = &self.byte_end; if *value < 0i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "byte_end", ), min: 0i64, actual: *value, }); } } { let value = &self.byte_start; if *value < 0i64 { return Err(::jacquard_lexicon::validation::ConstraintError::Minimum { path: ::jacquard_lexicon::validation::ValidationPath::from_field( "byte_start", ), min: 0i64, actual: *value, }); } } Ok(()) } } /// Facet feature for inline code. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, Default )] #[serde(rename_all = "camelCase")] pub struct Code<'a> {} impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Code<'a> { fn nsid() -> &'static str { "pub.leaflet.richtext.facet" } fn def_name() -> &'static str { "code" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_pub_leaflet_richtext_facet() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Facet feature for mentioning a did. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct DidMention<'a> { #[serde(borrow)] pub did: jacquard_common::types::string::Did<'a>, } pub mod did_mention_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 Did; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Did = Unset; } ///State transition - sets the `did` field to Set pub struct SetDid(PhantomData S>); impl sealed::Sealed for SetDid {} impl State for SetDid { type Did = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `did` field pub struct did(()); } } /// Builder for constructing an instance of this type pub struct DidMentionBuilder<'a, S: did_mention_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> DidMention<'a> { /// Create a new builder for this type pub fn new() -> DidMentionBuilder<'a, did_mention_state::Empty> { DidMentionBuilder::new() } } impl<'a> DidMentionBuilder<'a, did_mention_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { DidMentionBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None,), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> DidMentionBuilder<'a, S> where S: did_mention_state::State, S::Did: did_mention_state::IsUnset, { /// Set the `did` field (required) pub fn did( mut self, value: impl Into>, ) -> DidMentionBuilder<'a, did_mention_state::SetDid> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); DidMentionBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> DidMentionBuilder<'a, S> where S: did_mention_state::State, S::Did: did_mention_state::IsSet, { /// Build the final struct pub fn build(self) -> DidMention<'a> { DidMention { did: self.__unsafe_private_named.0.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>, >, ) -> DidMention<'a> { DidMention { did: self.__unsafe_private_named.0.unwrap(), extra_data: Some(extra_data), } } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for DidMention<'a> { fn nsid() -> &'static str { "pub.leaflet.richtext.facet" } fn def_name() -> &'static str { "didMention" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_pub_leaflet_richtext_facet() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Facet feature for highlighted text. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, Default )] #[serde(rename_all = "camelCase")] pub struct Highlight<'a> {} impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Highlight<'a> { fn nsid() -> &'static str { "pub.leaflet.richtext.facet" } fn def_name() -> &'static str { "highlight" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_pub_leaflet_richtext_facet() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Facet feature for an identifier. Used for linking to a segment #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, Default )] #[serde(rename_all = "camelCase")] pub struct Id<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub id: std::option::Option>, } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Id<'a> { fn nsid() -> &'static str { "pub.leaflet.richtext.facet" } fn def_name() -> &'static str { "id" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_pub_leaflet_richtext_facet() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Facet feature for italic text #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, Default )] #[serde(rename_all = "camelCase")] pub struct Italic<'a> {} impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Italic<'a> { fn nsid() -> &'static str { "pub.leaflet.richtext.facet" } fn def_name() -> &'static str { "italic" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_pub_leaflet_richtext_facet() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, Default )] #[serde(rename_all = "camelCase")] pub struct Link<'a> { #[serde(borrow)] pub uri: jacquard_common::CowStr<'a>, } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Link<'a> { fn nsid() -> &'static str { "pub.leaflet.richtext.facet" } fn def_name() -> &'static str { "link" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_pub_leaflet_richtext_facet() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Annotation of a sub-string within rich text. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct Facet<'a> { #[serde(borrow)] pub features: Vec>, #[serde(borrow)] pub index: crate::pub_leaflet::richtext::facet::ByteSlice<'a>, } pub mod facet_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 Features; type Index; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Features = Unset; type Index = Unset; } ///State transition - sets the `features` field to Set pub struct SetFeatures(PhantomData S>); impl sealed::Sealed for SetFeatures {} impl State for SetFeatures { type Features = Set; type Index = S::Index; } ///State transition - sets the `index` field to Set pub struct SetIndex(PhantomData S>); impl sealed::Sealed for SetIndex {} impl State for SetIndex { type Features = S::Features; type Index = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `features` field pub struct features(()); ///Marker type for the `index` field pub struct index(()); } } /// Builder for constructing an instance of this type pub struct FacetBuilder<'a, S: facet_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> Facet<'a> { /// Create a new builder for this type pub fn new() -> FacetBuilder<'a, facet_state::Empty> { FacetBuilder::new() } } impl<'a> FacetBuilder<'a, facet_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { FacetBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> FacetBuilder<'a, S> where S: facet_state::State, S::Features: facet_state::IsUnset, { /// Set the `features` field (required) pub fn features( mut self, value: impl Into>>, ) -> FacetBuilder<'a, facet_state::SetFeatures> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); FacetBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> FacetBuilder<'a, S> where S: facet_state::State, S::Index: facet_state::IsUnset, { /// Set the `index` field (required) pub fn index( mut self, value: impl Into>, ) -> FacetBuilder<'a, facet_state::SetIndex> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); FacetBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> FacetBuilder<'a, S> where S: facet_state::State, S::Features: facet_state::IsSet, S::Index: facet_state::IsSet, { /// Build the final struct pub fn build(self) -> Facet<'a> { Facet { features: self.__unsafe_private_named.0.unwrap(), index: self.__unsafe_private_named.1.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>, >, ) -> Facet<'a> { Facet { features: self.__unsafe_private_named.0.unwrap(), index: self.__unsafe_private_named.1.unwrap(), extra_data: Some(extra_data), } } } #[jacquard_derive::open_union] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(tag = "$type")] #[serde(bound(deserialize = "'de: 'a"))] pub enum FacetFeaturesItem<'a> { #[serde(rename = "pub.leaflet.richtext.facet#link")] Link(Box>), #[serde(rename = "pub.leaflet.richtext.facet#didMention")] DidMention(Box>), #[serde(rename = "pub.leaflet.richtext.facet#atMention")] AtMention(Box>), #[serde(rename = "pub.leaflet.richtext.facet#code")] Code(Box>), #[serde(rename = "pub.leaflet.richtext.facet#highlight")] Highlight(Box>), #[serde(rename = "pub.leaflet.richtext.facet#underline")] Underline(Box>), #[serde(rename = "pub.leaflet.richtext.facet#strikethrough")] Strikethrough(Box>), #[serde(rename = "pub.leaflet.richtext.facet#id")] Id(Box>), #[serde(rename = "pub.leaflet.richtext.facet#bold")] Bold(Box>), #[serde(rename = "pub.leaflet.richtext.facet#italic")] Italic(Box>), } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Facet<'a> { fn nsid() -> &'static str { "pub.leaflet.richtext.facet" } fn def_name() -> &'static str { "main" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_pub_leaflet_richtext_facet() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Facet feature for strikethrough markup #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, Default )] #[serde(rename_all = "camelCase")] pub struct Strikethrough<'a> {} impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Strikethrough<'a> { fn nsid() -> &'static str { "pub.leaflet.richtext.facet" } fn def_name() -> &'static str { "strikethrough" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_pub_leaflet_richtext_facet() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// Facet feature for underline markup #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, Default )] #[serde(rename_all = "camelCase")] pub struct Underline<'a> {} impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Underline<'a> { fn nsid() -> &'static str { "pub.leaflet.richtext.facet" } fn def_name() -> &'static str { "underline" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_pub_leaflet_richtext_facet() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } }