// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: sh.weaver.edit.cursor // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct ContainerId<'a> { #[serde(borrow)] pub value: ContainerIdValue<'a>, } pub mod container_id_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 Value; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Value = Unset; } ///State transition - sets the `value` field to Set pub struct SetValue(PhantomData S>); impl sealed::Sealed for SetValue {} impl State for SetValue { type Value = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `value` field pub struct value(()); } } /// Builder for constructing an instance of this type pub struct ContainerIdBuilder<'a, S: container_id_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: (::core::option::Option>,), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> ContainerId<'a> { /// Create a new builder for this type pub fn new() -> ContainerIdBuilder<'a, container_id_state::Empty> { ContainerIdBuilder::new() } } impl<'a> ContainerIdBuilder<'a, container_id_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { ContainerIdBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None,), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ContainerIdBuilder<'a, S> where S: container_id_state::State, S::Value: container_id_state::IsUnset, { /// Set the `value` field (required) pub fn value( mut self, value: impl Into>, ) -> ContainerIdBuilder<'a, container_id_state::SetValue> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); ContainerIdBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> ContainerIdBuilder<'a, S> where S: container_id_state::State, S::Value: container_id_state::IsSet, { /// Build the final struct pub fn build(self) -> ContainerId<'a> { ContainerId { value: 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>, >, ) -> ContainerId<'a> { ContainerId { value: self.__unsafe_private_named.0.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 ContainerIdValue<'a> { #[serde(rename = "sh.weaver.edit.cursor#normalContainerId")] NormalContainerId(Box>), #[serde(rename = "sh.weaver.edit.cursor#rootContainerId")] RootContainerId(Box>), } fn lexicon_doc_sh_weaver_edit_cursor() -> ::jacquard_lexicon::lexicon::LexiconDoc< 'static, > { ::jacquard_lexicon::lexicon::LexiconDoc { lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1, id: ::jacquard_common::CowStr::new_static("sh.weaver.edit.cursor"), revision: None, description: None, defs: { let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("containerId"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![::jacquard_common::smol_str::SmolStr::new_static("value")], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("value"), ::jacquard_lexicon::lexicon::LexObjectProperty::Union(::jacquard_lexicon::lexicon::LexRefUnion { description: None, refs: vec![ ::jacquard_common::CowStr::new_static("#normalContainerId"), ::jacquard_common::CowStr::new_static("#rootContainerId") ], closed: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("cursorSide"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![::jacquard_common::smol_str::SmolStr::new_static("value")], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("value"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("id"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("peer"), ::jacquard_common::smol_str::SmolStr::new_static("counter") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("counter"), ::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("peer"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("main"), ::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord { description: Some( ::jacquard_common::CowStr::new_static( "An edit record for a notebook.", ), ), key: Some(::jacquard_common::CowStr::new_static("tid")), record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("container"), ::jacquard_common::smol_str::SmolStr::new_static("id") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "container", ), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static("#containerId"), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("id"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static("#id"), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("side"), ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef { description: None, r#ref: ::jacquard_common::CowStr::new_static("#cursorSide"), }), ); map }, }), }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("normalContainerId"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("peer"), ::jacquard_common::smol_str::SmolStr::new_static("counter"), ::jacquard_common::smol_str::SmolStr::new_static("container_type") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "container_type", ), ::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("counter"), ::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("peer"), ::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger { description: None, default: None, minimum: None, maximum: None, r#enum: None, r#const: None, }), ); map }, }), ); map.insert( ::jacquard_common::smol_str::SmolStr::new_static("rootContainerId"), ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject { description: None, required: Some( vec![ ::jacquard_common::smol_str::SmolStr::new_static("name"), ::jacquard_common::smol_str::SmolStr::new_static("container_type") ], ), nullable: None, properties: { #[allow(unused_mut)] let mut map = ::alloc::collections::BTreeMap::new(); map.insert( ::jacquard_common::smol_str::SmolStr::new_static( "container_type", ), ::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("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 }, }), ); map }, } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for ContainerId<'a> { fn nsid() -> &'static str { "sh.weaver.edit.cursor" } fn def_name() -> &'static str { "containerId" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_edit_cursor() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct CursorSide<'a> { /// The side of an item the cursor is on (left = -1, right = 1, middle = 0) pub value: i64, } pub mod cursor_side_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 Value; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Value = Unset; } ///State transition - sets the `value` field to Set pub struct SetValue(PhantomData S>); impl sealed::Sealed for SetValue {} impl State for SetValue { type Value = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `value` field pub struct value(()); } } /// Builder for constructing an instance of this type pub struct CursorSideBuilder<'a, S: cursor_side_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: (::core::option::Option,), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> CursorSide<'a> { /// Create a new builder for this type pub fn new() -> CursorSideBuilder<'a, cursor_side_state::Empty> { CursorSideBuilder::new() } } impl<'a> CursorSideBuilder<'a, cursor_side_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { CursorSideBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None,), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> CursorSideBuilder<'a, S> where S: cursor_side_state::State, S::Value: cursor_side_state::IsUnset, { /// Set the `value` field (required) pub fn value( mut self, value: impl Into, ) -> CursorSideBuilder<'a, cursor_side_state::SetValue> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); CursorSideBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> CursorSideBuilder<'a, S> where S: cursor_side_state::State, S::Value: cursor_side_state::IsSet, { /// Build the final struct pub fn build(self) -> CursorSide<'a> { CursorSide { value: 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>, >, ) -> CursorSide<'a> { CursorSide { value: self.__unsafe_private_named.0.unwrap(), extra_data: Some(extra_data), } } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for CursorSide<'a> { fn nsid() -> &'static str { "sh.weaver.edit.cursor" } fn def_name() -> &'static str { "cursorSide" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_edit_cursor() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct Id<'a> { pub counter: i64, pub peer: i64, } pub mod id_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 Peer; type Counter; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Peer = Unset; type Counter = Unset; } ///State transition - sets the `peer` field to Set pub struct SetPeer(PhantomData S>); impl sealed::Sealed for SetPeer {} impl State for SetPeer { type Peer = Set; type Counter = S::Counter; } ///State transition - sets the `counter` field to Set pub struct SetCounter(PhantomData S>); impl sealed::Sealed for SetCounter {} impl State for SetCounter { type Peer = S::Peer; type Counter = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `peer` field pub struct peer(()); ///Marker type for the `counter` field pub struct counter(()); } } /// Builder for constructing an instance of this type pub struct IdBuilder<'a, S: id_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: (::core::option::Option, ::core::option::Option), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> Id<'a> { /// Create a new builder for this type pub fn new() -> IdBuilder<'a, id_state::Empty> { IdBuilder::new() } } impl<'a> IdBuilder<'a, id_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { IdBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> IdBuilder<'a, S> where S: id_state::State, S::Counter: id_state::IsUnset, { /// Set the `counter` field (required) pub fn counter( mut self, value: impl Into, ) -> IdBuilder<'a, id_state::SetCounter> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); IdBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> IdBuilder<'a, S> where S: id_state::State, S::Peer: id_state::IsUnset, { /// Set the `peer` field (required) pub fn peer(mut self, value: impl Into) -> IdBuilder<'a, id_state::SetPeer> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); IdBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> IdBuilder<'a, S> where S: id_state::State, S::Peer: id_state::IsSet, S::Counter: id_state::IsSet, { /// Build the final struct pub fn build(self) -> Id<'a> { Id { counter: self.__unsafe_private_named.0.unwrap(), peer: 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>, >, ) -> Id<'a> { Id { counter: self.__unsafe_private_named.0.unwrap(), peer: self.__unsafe_private_named.1.unwrap(), extra_data: Some(extra_data), } } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Id<'a> { fn nsid() -> &'static str { "sh.weaver.edit.cursor" } fn def_name() -> &'static str { "id" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_edit_cursor() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } /// An edit record for a notebook. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct Cursor<'a> { #[serde(borrow)] pub container: crate::sh_weaver::edit::cursor::ContainerId<'a>, #[serde(borrow)] pub id: crate::sh_weaver::edit::cursor::Id<'a>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub side: std::option::Option>, } pub mod cursor_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 Id; type Container; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Id = Unset; type Container = Unset; } ///State transition - sets the `id` field to Set pub struct SetId(PhantomData S>); impl sealed::Sealed for SetId {} impl State for SetId { type Id = Set; type Container = S::Container; } ///State transition - sets the `container` field to Set pub struct SetContainer(PhantomData S>); impl sealed::Sealed for SetContainer {} impl State for SetContainer { type Id = S::Id; type Container = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `id` field pub struct id(()); ///Marker type for the `container` field pub struct container(()); } } /// Builder for constructing an instance of this type pub struct CursorBuilder<'a, S: cursor_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> Cursor<'a> { /// Create a new builder for this type pub fn new() -> CursorBuilder<'a, cursor_state::Empty> { CursorBuilder::new() } } impl<'a> CursorBuilder<'a, cursor_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { CursorBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> CursorBuilder<'a, S> where S: cursor_state::State, S::Container: cursor_state::IsUnset, { /// Set the `container` field (required) pub fn container( mut self, value: impl Into>, ) -> CursorBuilder<'a, cursor_state::SetContainer> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); CursorBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> CursorBuilder<'a, S> where S: cursor_state::State, S::Id: cursor_state::IsUnset, { /// Set the `id` field (required) pub fn id( mut self, value: impl Into>, ) -> CursorBuilder<'a, cursor_state::SetId> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); CursorBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S: cursor_state::State> CursorBuilder<'a, S> { /// Set the `side` field (optional) pub fn side( mut self, value: impl Into>>, ) -> Self { self.__unsafe_private_named.2 = value.into(); self } /// Set the `side` field to an Option value (optional) pub fn maybe_side( mut self, value: Option>, ) -> Self { self.__unsafe_private_named.2 = value; self } } impl<'a, S> CursorBuilder<'a, S> where S: cursor_state::State, S::Id: cursor_state::IsSet, S::Container: cursor_state::IsSet, { /// Build the final struct pub fn build(self) -> Cursor<'a> { Cursor { container: self.__unsafe_private_named.0.unwrap(), id: self.__unsafe_private_named.1.unwrap(), side: self.__unsafe_private_named.2, 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>, >, ) -> Cursor<'a> { Cursor { container: self.__unsafe_private_named.0.unwrap(), id: self.__unsafe_private_named.1.unwrap(), side: self.__unsafe_private_named.2, extra_data: Some(extra_data), } } } impl<'a> Cursor<'a> { pub fn uri( uri: impl Into>, ) -> Result< jacquard_common::types::uri::RecordUri<'a, CursorRecord>, jacquard_common::types::uri::UriError, > { jacquard_common::types::uri::RecordUri::try_from_uri( jacquard_common::types::string::AtUri::new_cow(uri.into())?, ) } } /// Typed wrapper for GetRecord response with this collection's record type. #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct CursorGetRecordOutput<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub cid: std::option::Option>, #[serde(borrow)] pub uri: jacquard_common::types::string::AtUri<'a>, #[serde(borrow)] pub value: Cursor<'a>, } impl From> for Cursor<'_> { fn from(output: CursorGetRecordOutput<'_>) -> Self { use jacquard_common::IntoStatic; output.value.into_static() } } impl jacquard_common::types::collection::Collection for Cursor<'_> { const NSID: &'static str = "sh.weaver.edit.cursor"; type Record = CursorRecord; } /// Marker type for deserializing records from this collection. #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct CursorRecord; impl jacquard_common::xrpc::XrpcResp for CursorRecord { const NSID: &'static str = "sh.weaver.edit.cursor"; const ENCODING: &'static str = "application/json"; type Output<'de> = CursorGetRecordOutput<'de>; type Err<'de> = jacquard_common::types::collection::RecordError<'de>; } impl jacquard_common::types::collection::Collection for CursorRecord { const NSID: &'static str = "sh.weaver.edit.cursor"; type Record = CursorRecord; } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Cursor<'a> { fn nsid() -> &'static str { "sh.weaver.edit.cursor" } fn def_name() -> &'static str { "main" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_edit_cursor() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct NormalContainerId<'a> { #[serde(borrow)] pub container_type: jacquard_common::CowStr<'a>, pub counter: i64, pub peer: i64, } pub mod normal_container_id_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 Peer; type Counter; type ContainerType; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Peer = Unset; type Counter = Unset; type ContainerType = Unset; } ///State transition - sets the `peer` field to Set pub struct SetPeer(PhantomData S>); impl sealed::Sealed for SetPeer {} impl State for SetPeer { type Peer = Set; type Counter = S::Counter; type ContainerType = S::ContainerType; } ///State transition - sets the `counter` field to Set pub struct SetCounter(PhantomData S>); impl sealed::Sealed for SetCounter {} impl State for SetCounter { type Peer = S::Peer; type Counter = Set; type ContainerType = S::ContainerType; } ///State transition - sets the `container_type` field to Set pub struct SetContainerType(PhantomData S>); impl sealed::Sealed for SetContainerType {} impl State for SetContainerType { type Peer = S::Peer; type Counter = S::Counter; type ContainerType = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `peer` field pub struct peer(()); ///Marker type for the `counter` field pub struct counter(()); ///Marker type for the `container_type` field pub struct container_type(()); } } /// Builder for constructing an instance of this type pub struct NormalContainerIdBuilder<'a, S: normal_container_id_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>, ::core::option::Option, ::core::option::Option, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> NormalContainerId<'a> { /// Create a new builder for this type pub fn new() -> NormalContainerIdBuilder<'a, normal_container_id_state::Empty> { NormalContainerIdBuilder::new() } } impl<'a> NormalContainerIdBuilder<'a, normal_container_id_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { NormalContainerIdBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> NormalContainerIdBuilder<'a, S> where S: normal_container_id_state::State, S::ContainerType: normal_container_id_state::IsUnset, { /// Set the `container_type` field (required) pub fn container_type( mut self, value: impl Into>, ) -> NormalContainerIdBuilder<'a, normal_container_id_state::SetContainerType> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); NormalContainerIdBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> NormalContainerIdBuilder<'a, S> where S: normal_container_id_state::State, S::Counter: normal_container_id_state::IsUnset, { /// Set the `counter` field (required) pub fn counter( mut self, value: impl Into, ) -> NormalContainerIdBuilder<'a, normal_container_id_state::SetCounter> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); NormalContainerIdBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> NormalContainerIdBuilder<'a, S> where S: normal_container_id_state::State, S::Peer: normal_container_id_state::IsUnset, { /// Set the `peer` field (required) pub fn peer( mut self, value: impl Into, ) -> NormalContainerIdBuilder<'a, normal_container_id_state::SetPeer> { self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into()); NormalContainerIdBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> NormalContainerIdBuilder<'a, S> where S: normal_container_id_state::State, S::Peer: normal_container_id_state::IsSet, S::Counter: normal_container_id_state::IsSet, S::ContainerType: normal_container_id_state::IsSet, { /// Build the final struct pub fn build(self) -> NormalContainerId<'a> { NormalContainerId { container_type: self.__unsafe_private_named.0.unwrap(), counter: self.__unsafe_private_named.1.unwrap(), peer: self.__unsafe_private_named.2.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>, >, ) -> NormalContainerId<'a> { NormalContainerId { container_type: self.__unsafe_private_named.0.unwrap(), counter: self.__unsafe_private_named.1.unwrap(), peer: self.__unsafe_private_named.2.unwrap(), extra_data: Some(extra_data), } } } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for NormalContainerId<'a> { fn nsid() -> &'static str { "sh.weaver.edit.cursor" } fn def_name() -> &'static str { "normalContainerId" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_edit_cursor() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, Default )] #[serde(rename_all = "camelCase")] pub struct RootContainerId<'a> { #[serde(borrow)] pub container_type: jacquard_common::CowStr<'a>, #[serde(borrow)] pub name: jacquard_common::CowStr<'a>, } impl<'a> ::jacquard_lexicon::schema::LexiconSchema for RootContainerId<'a> { fn nsid() -> &'static str { "sh.weaver.edit.cursor" } fn def_name() -> &'static str { "rootContainerId" } fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> { lexicon_doc_sh_weaver_edit_cursor() } fn validate( &self, ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> { Ok(()) } }