Something went wrong. Try again.
atproto made easy crates.io/crates/jacquard
atproto rust
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598// @generated by jacquard-lexicon. DO NOT EDIT.//// Lexicon: org.atsui.Stack//// This file was automatically generated from Lexicon schemas.// Any manual changes will be overwritten on the next regeneration.
#[allow(unused_imports)]use alloc::collections::BTreeMap;
use crate::at_inlay::Response;#[allow(unused_imports)]use core::marker::PhantomData;use jacquard_common::deps::smol_str::SmolStr;use jacquard_common::types::value::Data;use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};use jacquard_derive::IntoStatic;use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]#[serde( rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]pub struct Stack<S: BosStr = DefaultStr> { /// Cross-axis alignment of children. Defaults to `"stretch"`. #[serde(skip_serializing_if = "Option::is_none")] #[serde(default = "_default_stack_align")] pub align: Option<StackAlign<S>>, pub children: Data<S>, /// Space between children. Defaults to `"medium"`. #[serde(skip_serializing_if = "Option::is_none")] #[serde(default = "_default_stack_gap")] pub gap: Option<StackGap<S>>, /// Whether this container has inset padding. The theme controls the amount. #[serde(skip_serializing_if = "Option::is_none")] pub inset: Option<bool>, /// Main-axis distribution of children. Defaults to `"start"`. #[serde(skip_serializing_if = "Option::is_none")] #[serde(default = "_default_stack_justify")] pub justify: Option<StackJustify<S>>, /// Whether the container has an opaque background. #[serde(skip_serializing_if = "Option::is_none")] pub opaque: Option<bool>, /// Whether to show a visual separator between children. #[serde(skip_serializing_if = "Option::is_none")] pub separator: Option<bool>, /// Whether the container sticks to the top of the scroll area. #[serde(skip_serializing_if = "Option::is_none")] pub sticky: Option<bool>, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,}
/// Cross-axis alignment of children.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub enum StackAlign<S: BosStr = DefaultStr> { Start, Center, End, Stretch, Other(S),}
impl<S: BosStr> StackAlign<S> { pub fn as_str(&self) -> &str { match self { Self::Start => "start", Self::Center => "center", Self::End => "end", Self::Stretch => "stretch", Self::Other(s) => s.as_ref(), } } /// Construct from a string-like value, matching known values. pub fn from_value(s: S) -> Self { match s.as_ref() { "start" => Self::Start, "center" => Self::Center, "end" => Self::End, "stretch" => Self::Stretch, _ => Self::Other(s), } }}
impl<S: BosStr> core::fmt::Display for StackAlign<S> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) }}
impl<S: BosStr> AsRef<str> for StackAlign<S> { fn as_ref(&self) -> &str { self.as_str() }}
impl<S: BosStr> Serialize for StackAlign<S> { fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error> where Ser: serde::Serializer, { serializer.serialize_str(self.as_str()) }}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for StackAlign<S> { fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de>, { let s = S::deserialize(deserializer)?; Ok(Self::from_value(s)) }}
impl<S: BosStr + Default> Default for StackAlign<S> { fn default() -> Self { Self::Other(Default::default()) }}
impl<S: BosStr> jacquard_common::IntoStatic for StackAlign<S>where S: BosStr + jacquard_common::IntoStatic, S::Output: BosStr,{ type Output = StackAlign<S::Output>; fn into_static(self) -> Self::Output { match self { StackAlign::Start => StackAlign::Start, StackAlign::Center => StackAlign::Center, StackAlign::End => StackAlign::End, StackAlign::Stretch => StackAlign::Stretch, StackAlign::Other(v) => StackAlign::Other(v.into_static()), } }}
/// Space between children.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub enum StackGap<S: BosStr = DefaultStr> { None, Small, Medium, Large, Other(S),}
impl<S: BosStr> StackGap<S> { pub fn as_str(&self) -> &str { match self { Self::None => "none", Self::Small => "small", Self::Medium => "medium", Self::Large => "large", Self::Other(s) => s.as_ref(), } } /// Construct from a string-like value, matching known values. pub fn from_value(s: S) -> Self { match s.as_ref() { "none" => Self::None, "small" => Self::Small, "medium" => Self::Medium, "large" => Self::Large, _ => Self::Other(s), } }}
impl<S: BosStr> core::fmt::Display for StackGap<S> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) }}
impl<S: BosStr> AsRef<str> for StackGap<S> { fn as_ref(&self) -> &str { self.as_str() }}
impl<S: BosStr> Serialize for StackGap<S> { fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error> where Ser: serde::Serializer, { serializer.serialize_str(self.as_str()) }}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for StackGap<S> { fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de>, { let s = S::deserialize(deserializer)?; Ok(Self::from_value(s)) }}
impl<S: BosStr + Default> Default for StackGap<S> { fn default() -> Self { Self::Other(Default::default()) }}
impl<S: BosStr> jacquard_common::IntoStatic for StackGap<S>where S: BosStr + jacquard_common::IntoStatic, S::Output: BosStr,{ type Output = StackGap<S::Output>; fn into_static(self) -> Self::Output { match self { StackGap::None => StackGap::None, StackGap::Small => StackGap::Small, StackGap::Medium => StackGap::Medium, StackGap::Large => StackGap::Large, StackGap::Other(v) => StackGap::Other(v.into_static()), } }}
/// Main-axis distribution of children.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub enum StackJustify<S: BosStr = DefaultStr> { Start, Center, End, Between, Other(S),}
impl<S: BosStr> StackJustify<S> { pub fn as_str(&self) -> &str { match self { Self::Start => "start", Self::Center => "center", Self::End => "end", Self::Between => "between", Self::Other(s) => s.as_ref(), } } /// Construct from a string-like value, matching known values. pub fn from_value(s: S) -> Self { match s.as_ref() { "start" => Self::Start, "center" => Self::Center, "end" => Self::End, "between" => Self::Between, _ => Self::Other(s), } }}
impl<S: BosStr> core::fmt::Display for StackJustify<S> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) }}
impl<S: BosStr> AsRef<str> for StackJustify<S> { fn as_ref(&self) -> &str { self.as_str() }}
impl<S: BosStr> Serialize for StackJustify<S> { fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error> where Ser: serde::Serializer, { serializer.serialize_str(self.as_str()) }}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for StackJustify<S> { fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de>, { let s = S::deserialize(deserializer)?; Ok(Self::from_value(s)) }}
impl<S: BosStr + Default> Default for StackJustify<S> { fn default() -> Self { Self::Other(Default::default()) }}
impl<S: BosStr> jacquard_common::IntoStatic for StackJustify<S>where S: BosStr + jacquard_common::IntoStatic, S::Output: BosStr,{ type Output = StackJustify<S::Output>; fn into_static(self) -> Self::Output { match self { StackJustify::Start => StackJustify::Start, StackJustify::Center => StackJustify::Center, StackJustify::End => StackJustify::End, StackJustify::Between => StackJustify::Between, StackJustify::Other(v) => StackJustify::Other(v.into_static()), } }}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]#[serde( rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]pub struct StackOutput<S: BosStr = DefaultStr> { #[serde(flatten)] pub value: Response<S>, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,}
/** Response marker for the `org.atsui.Stack` procedure.
Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `StackOutput<S>` for this endpoint.*/pub struct StackResponse;impl jacquard_common::xrpc::XrpcResp for StackResponse { const NSID: &'static str = "org.atsui.Stack"; const ENCODING: &'static str = "application/json"; type Output<S: BosStr> = StackOutput<S>; type Err = jacquard_common::xrpc::GenericError;}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for Stack<S> { const NSID: &'static str = "org.atsui.Stack"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); type Response = StackResponse;}
/** Endpoint marker for the `org.atsui.Stack` procedure.
Path: `/xrpc/org.atsui.Stack`. The request payload type is `Stack<S>`; send that request with `jacquard::Client` or use this marker through lower-level `XrpcEndpoint` APIs.*/pub struct StackRequest;impl jacquard_common::xrpc::XrpcEndpoint for StackRequest { const PATH: &'static str = "/xrpc/org.atsui.Stack"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); type Request<S: BosStr> = Stack<S>; type Response = StackResponse;}
fn _default_stack_align<S: FromStaticStr + BosStr>() -> ::core::option::Option<StackAlign<S>> { Some(<StackAlign<S>>::from_value(S::from_static("stretch")))}
fn _default_stack_gap<S: FromStaticStr + BosStr>() -> ::core::option::Option<StackGap<S>> { Some(<StackGap<S>>::from_value(S::from_static("medium")))}
fn _default_stack_justify<S: FromStaticStr + BosStr>() -> ::core::option::Option<StackJustify<S>> { Some(<StackJustify<S>>::from_value(S::from_static("start")))}
pub mod stack_state {
pub use crate::builder_types::{IsSet, IsUnset, Set, Unset}; #[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 Children; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Children = Unset; } ///State transition - sets the `children` field to Set pub struct SetChildren<St: State = Empty>(PhantomData<fn() -> St>); impl<St: State> sealed::Sealed for SetChildren<St> {} impl<St: State> State for SetChildren<St> { type Children = Set<members::children>; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `children` field pub struct children(()); }}
/// Builder for constructing an instance of this type.pub struct StackBuilder<St: stack_state::State, S: BosStr = DefaultStr> { _state: PhantomData<fn() -> St>, _fields: ( Option<StackAlign<S>>, Option<Data<S>>, Option<StackGap<S>>, Option<bool>, Option<StackJustify<S>>, Option<bool>, Option<bool>, Option<bool>, ), _type: PhantomData<fn() -> S>,}
impl Stack<DefaultStr> { /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed pub fn new() -> StackBuilder<stack_state::Empty, DefaultStr> { StackBuilder::new() }}
impl<S: BosStr> Stack<S> { /// Create a new builder for this type pub fn builder() -> StackBuilder<stack_state::Empty, S> { StackBuilder::builder() }}
impl StackBuilder<stack_state::Empty, DefaultStr> { /// Create a new builder with all fields unset, using the default string type, if needed pub fn new() -> Self { StackBuilder { _state: PhantomData, _fields: (None, None, None, None, None, None, None, None), _type: PhantomData, } }}
impl<S: BosStr> StackBuilder<stack_state::Empty, S> { /// Create a new builder with all fields unset pub fn builder() -> Self { StackBuilder { _state: PhantomData, _fields: (None, None, None, None, None, None, None, None), _type: PhantomData, } }}
impl<St: stack_state::State, S: BosStr> StackBuilder<St, S> { /// Set the `align` field (optional) pub fn align(mut self, value: impl Into<Option<StackAlign<S>>>) -> Self { self._fields.0 = value.into(); self } /// Set the `align` field to an Option value (optional) pub fn maybe_align(mut self, value: Option<StackAlign<S>>) -> Self { self._fields.0 = value; self }}
impl<St, S: BosStr> StackBuilder<St, S>where St: stack_state::State, St::Children: stack_state::IsUnset,{ /// Set the `children` field (required) pub fn children( mut self, value: impl Into<Data<S>>, ) -> StackBuilder<stack_state::SetChildren<St>, S> { self._fields.1 = Option::Some(value.into()); StackBuilder { _state: PhantomData, _fields: self._fields, _type: PhantomData, } }}
impl<St: stack_state::State, S: BosStr> StackBuilder<St, S> { /// Set the `gap` field (optional) pub fn gap(mut self, value: impl Into<Option<StackGap<S>>>) -> Self { self._fields.2 = value.into(); self } /// Set the `gap` field to an Option value (optional) pub fn maybe_gap(mut self, value: Option<StackGap<S>>) -> Self { self._fields.2 = value; self }}
impl<St: stack_state::State, S: BosStr> StackBuilder<St, S> { /// Set the `inset` field (optional) pub fn inset(mut self, value: impl Into<Option<bool>>) -> Self { self._fields.3 = value.into(); self } /// Set the `inset` field to an Option value (optional) pub fn maybe_inset(mut self, value: Option<bool>) -> Self { self._fields.3 = value; self }}
impl<St: stack_state::State, S: BosStr> StackBuilder<St, S> { /// Set the `justify` field (optional) pub fn justify(mut self, value: impl Into<Option<StackJustify<S>>>) -> Self { self._fields.4 = value.into(); self } /// Set the `justify` field to an Option value (optional) pub fn maybe_justify(mut self, value: Option<StackJustify<S>>) -> Self { self._fields.4 = value; self }}
impl<St: stack_state::State, S: BosStr> StackBuilder<St, S> { /// Set the `opaque` field (optional) pub fn opaque(mut self, value: impl Into<Option<bool>>) -> Self { self._fields.5 = value.into(); self } /// Set the `opaque` field to an Option value (optional) pub fn maybe_opaque(mut self, value: Option<bool>) -> Self { self._fields.5 = value; self }}
impl<St: stack_state::State, S: BosStr> StackBuilder<St, S> { /// Set the `separator` field (optional) pub fn separator(mut self, value: impl Into<Option<bool>>) -> Self { self._fields.6 = value.into(); self } /// Set the `separator` field to an Option value (optional) pub fn maybe_separator(mut self, value: Option<bool>) -> Self { self._fields.6 = value; self }}
impl<St: stack_state::State, S: BosStr> StackBuilder<St, S> { /// Set the `sticky` field (optional) pub fn sticky(mut self, value: impl Into<Option<bool>>) -> Self { self._fields.7 = value.into(); self } /// Set the `sticky` field to an Option value (optional) pub fn maybe_sticky(mut self, value: Option<bool>) -> Self { self._fields.7 = value; self }}
impl<St, S: BosStr> StackBuilder<St, S>where St: stack_state::State, St::Children: stack_state::IsSet,{ /// Build the final struct. pub fn build(self) -> Stack<S> { Stack { align: self._fields.0, children: self._fields.1.unwrap(), gap: self._fields.2, inset: self._fields.3, justify: self._fields.4, opaque: self._fields.5, separator: self._fields.6, sticky: self._fields.7, extra_data: Default::default(), } } /// Build the final struct with custom extra_data. pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Stack<S> { Stack { align: self._fields.0, children: self._fields.1.unwrap(), gap: self._fields.2, inset: self._fields.3, justify: self._fields.4, opaque: self._fields.5, separator: self._fields.6, sticky: self._fields.7, extra_data: Some(extra_data), } }}