// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: tools.ozone.setting.removeOptions // // 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 RemoveOptions<'a> { #[serde(borrow)] pub keys: Vec>, #[serde(borrow)] pub scope: RemoveOptionsScope<'a>, } pub mod remove_options_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 Keys; type Scope; } /// Empty state - all required fields are unset pub struct Empty(()); impl sealed::Sealed for Empty {} impl State for Empty { type Keys = Unset; type Scope = Unset; } ///State transition - sets the `keys` field to Set pub struct SetKeys(PhantomData S>); impl sealed::Sealed for SetKeys {} impl State for SetKeys { type Keys = Set; type Scope = S::Scope; } ///State transition - sets the `scope` field to Set pub struct SetScope(PhantomData S>); impl sealed::Sealed for SetScope {} impl State for SetScope { type Keys = S::Keys; type Scope = Set; } /// Marker types for field names #[allow(non_camel_case_types)] pub mod members { ///Marker type for the `keys` field pub struct keys(()); ///Marker type for the `scope` field pub struct scope(()); } } /// Builder for constructing an instance of this type pub struct RemoveOptionsBuilder<'a, S: remove_options_state::State> { _phantom_state: ::core::marker::PhantomData S>, __unsafe_private_named: ( ::core::option::Option>>, ::core::option::Option>, ), _phantom: ::core::marker::PhantomData<&'a ()>, } impl<'a> RemoveOptions<'a> { /// Create a new builder for this type pub fn new() -> RemoveOptionsBuilder<'a, remove_options_state::Empty> { RemoveOptionsBuilder::new() } } impl<'a> RemoveOptionsBuilder<'a, remove_options_state::Empty> { /// Create a new builder with all fields unset pub fn new() -> Self { RemoveOptionsBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: (None, None), _phantom: ::core::marker::PhantomData, } } } impl<'a, S> RemoveOptionsBuilder<'a, S> where S: remove_options_state::State, S::Keys: remove_options_state::IsUnset, { /// Set the `keys` field (required) pub fn keys( mut self, value: impl Into>>, ) -> RemoveOptionsBuilder<'a, remove_options_state::SetKeys> { self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into()); RemoveOptionsBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> RemoveOptionsBuilder<'a, S> where S: remove_options_state::State, S::Scope: remove_options_state::IsUnset, { /// Set the `scope` field (required) pub fn scope( mut self, value: impl Into>, ) -> RemoveOptionsBuilder<'a, remove_options_state::SetScope> { self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into()); RemoveOptionsBuilder { _phantom_state: ::core::marker::PhantomData, __unsafe_private_named: self.__unsafe_private_named, _phantom: ::core::marker::PhantomData, } } } impl<'a, S> RemoveOptionsBuilder<'a, S> where S: remove_options_state::State, S::Keys: remove_options_state::IsSet, S::Scope: remove_options_state::IsSet, { /// Build the final struct pub fn build(self) -> RemoveOptions<'a> { RemoveOptions { keys: self.__unsafe_private_named.0.unwrap(), scope: 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>, >, ) -> RemoveOptions<'a> { RemoveOptions { keys: self.__unsafe_private_named.0.unwrap(), scope: self.__unsafe_private_named.1.unwrap(), extra_data: Some(extra_data), } } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum RemoveOptionsScope<'a> { Instance, Personal, Other(jacquard_common::CowStr<'a>), } impl<'a> RemoveOptionsScope<'a> { pub fn as_str(&self) -> &str { match self { Self::Instance => "instance", Self::Personal => "personal", Self::Other(s) => s.as_ref(), } } } impl<'a> From<&'a str> for RemoveOptionsScope<'a> { fn from(s: &'a str) -> Self { match s { "instance" => Self::Instance, "personal" => Self::Personal, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> From for RemoveOptionsScope<'a> { fn from(s: String) -> Self { match s.as_str() { "instance" => Self::Instance, "personal" => Self::Personal, _ => Self::Other(jacquard_common::CowStr::from(s)), } } } impl<'a> core::fmt::Display for RemoveOptionsScope<'a> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) } } impl<'a> AsRef for RemoveOptionsScope<'a> { fn as_ref(&self) -> &str { self.as_str() } } impl<'a> serde::Serialize for RemoveOptionsScope<'a> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, { serializer.serialize_str(self.as_str()) } } impl<'de, 'a> serde::Deserialize<'de> for RemoveOptionsScope<'a> where 'de: 'a, { fn deserialize(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = <&'de str>::deserialize(deserializer)?; Ok(Self::from(s)) } } impl<'a> Default for RemoveOptionsScope<'a> { fn default() -> Self { Self::Other(Default::default()) } } impl jacquard_common::IntoStatic for RemoveOptionsScope<'_> { type Output = RemoveOptionsScope<'static>; fn into_static(self) -> Self::Output { match self { RemoveOptionsScope::Instance => RemoveOptionsScope::Instance, RemoveOptionsScope::Personal => RemoveOptionsScope::Personal, RemoveOptionsScope::Other(v) => RemoveOptionsScope::Other(v.into_static()), } } } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, Default )] #[serde(rename_all = "camelCase")] pub struct RemoveOptionsOutput<'a> {} /// Response type for ///tools.ozone.setting.removeOptions pub struct RemoveOptionsResponse; impl jacquard_common::xrpc::XrpcResp for RemoveOptionsResponse { const NSID: &'static str = "tools.ozone.setting.removeOptions"; const ENCODING: &'static str = "application/json"; type Output<'de> = RemoveOptionsOutput<'de>; type Err<'de> = jacquard_common::xrpc::GenericError<'de>; } impl<'a> jacquard_common::xrpc::XrpcRequest for RemoveOptions<'a> { const NSID: &'static str = "tools.ozone.setting.removeOptions"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Response = RemoveOptionsResponse; } /// Endpoint type for ///tools.ozone.setting.removeOptions pub struct RemoveOptionsRequest; impl jacquard_common::xrpc::XrpcEndpoint for RemoveOptionsRequest { const PATH: &'static str = "/xrpc/tools.ozone.setting.removeOptions"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Request<'de> = RemoveOptions<'de>; type Response = RemoveOptionsResponse; }