jacquard_api/pub_leaflet/blocks/
poll.rs1#[jacquard_derive::lexicon]
9#[derive(
10 serde::Serialize,
11 serde::Deserialize,
12 Debug,
13 Clone,
14 PartialEq,
15 Eq,
16 jacquard_derive::IntoStatic
17)]
18#[serde(rename_all = "camelCase")]
19pub struct Poll<'a> {
20 #[serde(borrow)]
21 pub poll_ref: crate::com_atproto::repo::strong_ref::StrongRef<'a>,
22}
23
24pub mod poll_state {
25
26 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
27 #[allow(unused)]
28 use ::core::marker::PhantomData;
29 mod sealed {
30 pub trait Sealed {}
31 }
32 pub trait State: sealed::Sealed {
34 type PollRef;
35 }
36 pub struct Empty(());
38 impl sealed::Sealed for Empty {}
39 impl State for Empty {
40 type PollRef = Unset;
41 }
42 pub struct SetPollRef<S: State = Empty>(PhantomData<fn() -> S>);
44 impl<S: State> sealed::Sealed for SetPollRef<S> {}
45 impl<S: State> State for SetPollRef<S> {
46 type PollRef = Set<members::poll_ref>;
47 }
48 #[allow(non_camel_case_types)]
50 pub mod members {
51 pub struct poll_ref(());
53 }
54}
55
56pub struct PollBuilder<'a, S: poll_state::State> {
58 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
59 __unsafe_private_named: (
60 ::core::option::Option<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
61 ),
62 _phantom: ::core::marker::PhantomData<&'a ()>,
63}
64
65impl<'a> Poll<'a> {
66 pub fn new() -> PollBuilder<'a, poll_state::Empty> {
68 PollBuilder::new()
69 }
70}
71
72impl<'a> PollBuilder<'a, poll_state::Empty> {
73 pub fn new() -> Self {
75 PollBuilder {
76 _phantom_state: ::core::marker::PhantomData,
77 __unsafe_private_named: (None,),
78 _phantom: ::core::marker::PhantomData,
79 }
80 }
81}
82
83impl<'a, S> PollBuilder<'a, S>
84where
85 S: poll_state::State,
86 S::PollRef: poll_state::IsUnset,
87{
88 pub fn poll_ref(
90 mut self,
91 value: impl Into<crate::com_atproto::repo::strong_ref::StrongRef<'a>>,
92 ) -> PollBuilder<'a, poll_state::SetPollRef<S>> {
93 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
94 PollBuilder {
95 _phantom_state: ::core::marker::PhantomData,
96 __unsafe_private_named: self.__unsafe_private_named,
97 _phantom: ::core::marker::PhantomData,
98 }
99 }
100}
101
102impl<'a, S> PollBuilder<'a, S>
103where
104 S: poll_state::State,
105 S::PollRef: poll_state::IsSet,
106{
107 pub fn build(self) -> Poll<'a> {
109 Poll {
110 poll_ref: self.__unsafe_private_named.0.unwrap(),
111 extra_data: Default::default(),
112 }
113 }
114 pub fn build_with_data(
116 self,
117 extra_data: std::collections::BTreeMap<
118 jacquard_common::smol_str::SmolStr,
119 jacquard_common::types::value::Data<'a>,
120 >,
121 ) -> Poll<'a> {
122 Poll {
123 poll_ref: self.__unsafe_private_named.0.unwrap(),
124 extra_data: Some(extra_data),
125 }
126 }
127}
128
129fn lexicon_doc_pub_leaflet_blocks_poll() -> ::jacquard_lexicon::lexicon::LexiconDoc<
130 'static,
131> {
132 ::jacquard_lexicon::lexicon::LexiconDoc {
133 lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
134 id: ::jacquard_common::CowStr::new_static("pub.leaflet.blocks.poll"),
135 revision: None,
136 description: None,
137 defs: {
138 let mut map = ::std::collections::BTreeMap::new();
139 map.insert(
140 ::jacquard_common::smol_str::SmolStr::new_static("main"),
141 ::jacquard_lexicon::lexicon::LexUserType::Object(::jacquard_lexicon::lexicon::LexObject {
142 description: None,
143 required: Some(
144 vec![::jacquard_common::smol_str::SmolStr::new_static("pollRef")],
145 ),
146 nullable: None,
147 properties: {
148 #[allow(unused_mut)]
149 let mut map = ::std::collections::BTreeMap::new();
150 map.insert(
151 ::jacquard_common::smol_str::SmolStr::new_static("pollRef"),
152 ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
153 description: None,
154 r#ref: ::jacquard_common::CowStr::new_static(
155 "com.atproto.repo.strongRef",
156 ),
157 }),
158 );
159 map
160 },
161 }),
162 );
163 map
164 },
165 }
166}
167
168impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Poll<'a> {
169 fn nsid() -> &'static str {
170 "pub.leaflet.blocks.poll"
171 }
172 fn def_name() -> &'static str {
173 "main"
174 }
175 fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
176 lexicon_doc_pub_leaflet_blocks_poll()
177 }
178 fn validate(
179 &self,
180 ) -> ::std::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
181 Ok(())
182 }
183}