#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::collection::{Collection, RecordError};
use jacquard_common::types::string::{AtUri, Cid, Datetime};
use jacquard_common::types::uri::{RecordUri, UriError};
use jacquard_common::xrpc::XrpcResp;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;
#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};
use crate::com_atproto::repo::strong_ref::StrongRef;
use crate::blue_atroom::room::layout;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Color<'a> {
pub blue: i64,
pub green: i64,
pub red: i64,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Floor<'a> {
#[serde(borrow)]
pub surface: layout::Surface<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Furnishing<'a> {
#[serde(borrow)]
pub object: StrongRef<'a>,
pub position: Vec<i64>,
pub rotation: Vec<i64>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Layout<'a> {
pub created_at: Datetime,
#[serde(borrow)]
pub floor: layout::Floor<'a>,
#[serde(borrow)]
pub furnishings: Vec<layout::Furnishing<'a>>,
pub size: i64,
#[serde(borrow)]
pub wall: layout::Wall<'a>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct LayoutGetRecordOutput<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub cid: Option<Cid<'a>>,
#[serde(borrow)]
pub uri: AtUri<'a>,
#[serde(borrow)]
pub value: Layout<'a>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Surface<'a> {
#[serde(borrow)]
pub color: layout::Color<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(borrow)]
pub texture: Option<CowStr<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub texture_tiling: Option<Vec<i64>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Wall<'a> {
pub height: i64,
#[serde(borrow)]
pub surface: layout::Surface<'a>,
pub thickness: i64,
}
impl<'a> Layout<'a> {
pub fn uri(
uri: impl Into<CowStr<'a>>,
) -> Result<RecordUri<'a, LayoutRecord>, UriError> {
RecordUri::try_from_uri(AtUri::new_cow(uri.into())?)
}
}
impl<'a> LexiconSchema for Color<'a> {
fn nsid() -> &'static str {
"blue.atroom.room.layout"
}
fn def_name() -> &'static str {
"color"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_blue_atroom_room_layout()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.blue;
if *value > 255i64 {
return Err(ConstraintError::Maximum {
path: ValidationPath::from_field("blue"),
max: 255i64,
actual: *value,
});
}
}
{
let value = &self.blue;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("blue"),
min: 0i64,
actual: *value,
});
}
}
{
let value = &self.green;
if *value > 255i64 {
return Err(ConstraintError::Maximum {
path: ValidationPath::from_field("green"),
max: 255i64,
actual: *value,
});
}
}
{
let value = &self.green;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("green"),
min: 0i64,
actual: *value,
});
}
}
{
let value = &self.red;
if *value > 255i64 {
return Err(ConstraintError::Maximum {
path: ValidationPath::from_field("red"),
max: 255i64,
actual: *value,
});
}
}
{
let value = &self.red;
if *value < 0i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("red"),
min: 0i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for Floor<'a> {
fn nsid() -> &'static str {
"blue.atroom.room.layout"
}
fn def_name() -> &'static str {
"floor"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_blue_atroom_room_layout()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<'a> LexiconSchema for Furnishing<'a> {
fn nsid() -> &'static str {
"blue.atroom.room.layout"
}
fn def_name() -> &'static str {
"furnishing"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_blue_atroom_room_layout()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.position;
#[allow(unused_comparisons)]
if value.len() > 3usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("position"),
max: 3usize,
actual: value.len(),
});
}
}
{
let value = &self.position;
#[allow(unused_comparisons)]
if value.len() < 3usize {
return Err(ConstraintError::MinLength {
path: ValidationPath::from_field("position"),
min: 3usize,
actual: value.len(),
});
}
}
{
let value = &self.rotation;
#[allow(unused_comparisons)]
if value.len() > 3usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("rotation"),
max: 3usize,
actual: value.len(),
});
}
}
{
let value = &self.rotation;
#[allow(unused_comparisons)]
if value.len() < 3usize {
return Err(ConstraintError::MinLength {
path: ValidationPath::from_field("rotation"),
min: 3usize,
actual: value.len(),
});
}
}
Ok(())
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct LayoutRecord;
impl XrpcResp for LayoutRecord {
const NSID: &'static str = "blue.atroom.room.layout";
const ENCODING: &'static str = "application/json";
type Output<'de> = LayoutGetRecordOutput<'de>;
type Err<'de> = RecordError<'de>;
}
impl From<LayoutGetRecordOutput<'_>> for Layout<'_> {
fn from(output: LayoutGetRecordOutput<'_>) -> Self {
use jacquard_common::IntoStatic;
output.value.into_static()
}
}
impl Collection for Layout<'_> {
const NSID: &'static str = "blue.atroom.room.layout";
type Record = LayoutRecord;
}
impl Collection for LayoutRecord {
const NSID: &'static str = "blue.atroom.room.layout";
type Record = LayoutRecord;
}
impl<'a> LexiconSchema for Layout<'a> {
fn nsid() -> &'static str {
"blue.atroom.room.layout"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_blue_atroom_room_layout()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.furnishings;
#[allow(unused_comparisons)]
if value.len() > 100usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("furnishings"),
max: 100usize,
actual: value.len(),
});
}
}
{
let value = &self.size;
if *value > 20000i64 {
return Err(ConstraintError::Maximum {
path: ValidationPath::from_field("size"),
max: 20000i64,
actual: *value,
});
}
}
{
let value = &self.size;
if *value < 1000i64 {
return Err(ConstraintError::Minimum {
path: ValidationPath::from_field("size"),
min: 1000i64,
actual: *value,
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for Surface<'a> {
fn nsid() -> &'static str {
"blue.atroom.room.layout"
}
fn def_name() -> &'static str {
"surface"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_blue_atroom_room_layout()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.texture_tiling {
#[allow(unused_comparisons)]
if value.len() > 2usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("texture_tiling"),
max: 2usize,
actual: value.len(),
});
}
}
if let Some(ref value) = self.texture_tiling {
#[allow(unused_comparisons)]
if value.len() < 2usize {
return Err(ConstraintError::MinLength {
path: ValidationPath::from_field("texture_tiling"),
min: 2usize,
actual: value.len(),
});
}
}
Ok(())
}
}
impl<'a> LexiconSchema for Wall<'a> {
fn nsid() -> &'static str {
"blue.atroom.room.layout"
}
fn def_name() -> &'static str {
"wall"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_blue_atroom_room_layout()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod color_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Red;
type Green;
type Blue;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Red = Unset;
type Green = Unset;
type Blue = Unset;
}
pub struct SetRed<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRed<S> {}
impl<S: State> State for SetRed<S> {
type Red = Set<members::red>;
type Green = S::Green;
type Blue = S::Blue;
}
pub struct SetGreen<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetGreen<S> {}
impl<S: State> State for SetGreen<S> {
type Red = S::Red;
type Green = Set<members::green>;
type Blue = S::Blue;
}
pub struct SetBlue<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetBlue<S> {}
impl<S: State> State for SetBlue<S> {
type Red = S::Red;
type Green = S::Green;
type Blue = Set<members::blue>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct red(());
pub struct green(());
pub struct blue(());
}
}
pub struct ColorBuilder<'a, S: color_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<i64>, Option<i64>, Option<i64>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Color<'a> {
pub fn new() -> ColorBuilder<'a, color_state::Empty> {
ColorBuilder::new()
}
}
impl<'a> ColorBuilder<'a, color_state::Empty> {
pub fn new() -> Self {
ColorBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> ColorBuilder<'a, S>
where
S: color_state::State,
S::Blue: color_state::IsUnset,
{
pub fn blue(
mut self,
value: impl Into<i64>,
) -> ColorBuilder<'a, color_state::SetBlue<S>> {
self._fields.0 = Option::Some(value.into());
ColorBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ColorBuilder<'a, S>
where
S: color_state::State,
S::Green: color_state::IsUnset,
{
pub fn green(
mut self,
value: impl Into<i64>,
) -> ColorBuilder<'a, color_state::SetGreen<S>> {
self._fields.1 = Option::Some(value.into());
ColorBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ColorBuilder<'a, S>
where
S: color_state::State,
S::Red: color_state::IsUnset,
{
pub fn red(
mut self,
value: impl Into<i64>,
) -> ColorBuilder<'a, color_state::SetRed<S>> {
self._fields.2 = Option::Some(value.into());
ColorBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> ColorBuilder<'a, S>
where
S: color_state::State,
S::Red: color_state::IsSet,
S::Green: color_state::IsSet,
S::Blue: color_state::IsSet,
{
pub fn build(self) -> Color<'a> {
Color {
blue: self._fields.0.unwrap(),
green: self._fields.1.unwrap(),
red: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Color<'a> {
Color {
blue: self._fields.0.unwrap(),
green: self._fields.1.unwrap(),
red: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_blue_atroom_room_layout() -> LexiconDoc<'static> {
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
use alloc::collections::BTreeMap;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("blue.atroom.room.layout"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("color"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("RGB color with 8-bit channels."),
),
required: Some(
vec![
SmolStr::new_static("red"), SmolStr::new_static("green"),
SmolStr::new_static("blue")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("blue"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
maximum: Some(255i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("green"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
maximum: Some(255i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("red"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(0i64),
maximum: Some(255i64),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("floor"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("surface")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("surface"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#surface"),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("furnishing"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static("A placed object in the room."),
),
required: Some(
vec![
SmolStr::new_static("object"),
SmolStr::new_static("position"),
SmolStr::new_static("rotation")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("object"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("com.atproto.repo.strongRef"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("position"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static("Position [x, y, z] in millimeters."),
),
items: LexArrayItem::Integer(LexInteger {
..Default::default()
}),
min_length: Some(3usize),
max_length: Some(3usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("rotation"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static("Euler rotation [x, y, z] in degrees."),
),
items: LexArrayItem::Integer(LexInteger {
..Default::default()
}),
min_length: Some(3usize),
max_length: Some(3usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("main"),
LexUserType::Record(LexRecord {
description: Some(
CowStr::new_static("A room layout with placed objects."),
),
key: Some(CowStr::new_static("any")),
record: LexRecordRecord::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("size"), SmolStr::new_static("floor"),
SmolStr::new_static("wall"),
SmolStr::new_static("furnishings"),
SmolStr::new_static("createdAt")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("createdAt"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("floor"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#floor"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("furnishings"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#furnishing"),
..Default::default()
}),
max_length: Some(100usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("size"),
LexObjectProperty::Integer(LexInteger {
minimum: Some(1000i64),
maximum: Some(20000i64),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("wall"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#wall"),
..Default::default()
}),
);
map
},
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("surface"),
LexUserType::Object(LexObject {
required: Some(vec![SmolStr::new_static("color")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("color"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#color"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("texture"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static("Texture identifier."),
),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("textureTiling"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static("Texture tiling [u, v]."),
),
items: LexArrayItem::Integer(LexInteger {
..Default::default()
}),
min_length: Some(2usize),
max_length: Some(2usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("wall"),
LexUserType::Object(LexObject {
description: Some(CowStr::new_static("Wall configuration.")),
required: Some(
vec![
SmolStr::new_static("height"),
SmolStr::new_static("thickness"),
SmolStr::new_static("surface")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("height"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("surface"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("#surface"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("thickness"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod floor_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Surface;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Surface = Unset;
}
pub struct SetSurface<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSurface<S> {}
impl<S: State> State for SetSurface<S> {
type Surface = Set<members::surface>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct surface(());
}
}
pub struct FloorBuilder<'a, S: floor_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<layout::Surface<'a>>,),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Floor<'a> {
pub fn new() -> FloorBuilder<'a, floor_state::Empty> {
FloorBuilder::new()
}
}
impl<'a> FloorBuilder<'a, floor_state::Empty> {
pub fn new() -> Self {
FloorBuilder {
_state: PhantomData,
_fields: (None,),
_lifetime: PhantomData,
}
}
}
impl<'a, S> FloorBuilder<'a, S>
where
S: floor_state::State,
S::Surface: floor_state::IsUnset,
{
pub fn surface(
mut self,
value: impl Into<layout::Surface<'a>>,
) -> FloorBuilder<'a, floor_state::SetSurface<S>> {
self._fields.0 = Option::Some(value.into());
FloorBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> FloorBuilder<'a, S>
where
S: floor_state::State,
S::Surface: floor_state::IsSet,
{
pub fn build(self) -> Floor<'a> {
Floor {
surface: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Floor<'a> {
Floor {
surface: self._fields.0.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod furnishing_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Rotation;
type Position;
type Object;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Rotation = Unset;
type Position = Unset;
type Object = Unset;
}
pub struct SetRotation<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetRotation<S> {}
impl<S: State> State for SetRotation<S> {
type Rotation = Set<members::rotation>;
type Position = S::Position;
type Object = S::Object;
}
pub struct SetPosition<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetPosition<S> {}
impl<S: State> State for SetPosition<S> {
type Rotation = S::Rotation;
type Position = Set<members::position>;
type Object = S::Object;
}
pub struct SetObject<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetObject<S> {}
impl<S: State> State for SetObject<S> {
type Rotation = S::Rotation;
type Position = S::Position;
type Object = Set<members::object>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct rotation(());
pub struct position(());
pub struct object(());
}
}
pub struct FurnishingBuilder<'a, S: furnishing_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<StrongRef<'a>>, Option<Vec<i64>>, Option<Vec<i64>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Furnishing<'a> {
pub fn new() -> FurnishingBuilder<'a, furnishing_state::Empty> {
FurnishingBuilder::new()
}
}
impl<'a> FurnishingBuilder<'a, furnishing_state::Empty> {
pub fn new() -> Self {
FurnishingBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> FurnishingBuilder<'a, S>
where
S: furnishing_state::State,
S::Object: furnishing_state::IsUnset,
{
pub fn object(
mut self,
value: impl Into<StrongRef<'a>>,
) -> FurnishingBuilder<'a, furnishing_state::SetObject<S>> {
self._fields.0 = Option::Some(value.into());
FurnishingBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> FurnishingBuilder<'a, S>
where
S: furnishing_state::State,
S::Position: furnishing_state::IsUnset,
{
pub fn position(
mut self,
value: impl Into<Vec<i64>>,
) -> FurnishingBuilder<'a, furnishing_state::SetPosition<S>> {
self._fields.1 = Option::Some(value.into());
FurnishingBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> FurnishingBuilder<'a, S>
where
S: furnishing_state::State,
S::Rotation: furnishing_state::IsUnset,
{
pub fn rotation(
mut self,
value: impl Into<Vec<i64>>,
) -> FurnishingBuilder<'a, furnishing_state::SetRotation<S>> {
self._fields.2 = Option::Some(value.into());
FurnishingBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> FurnishingBuilder<'a, S>
where
S: furnishing_state::State,
S::Rotation: furnishing_state::IsSet,
S::Position: furnishing_state::IsSet,
S::Object: furnishing_state::IsSet,
{
pub fn build(self) -> Furnishing<'a> {
Furnishing {
object: self._fields.0.unwrap(),
position: self._fields.1.unwrap(),
rotation: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Furnishing<'a> {
Furnishing {
object: self._fields.0.unwrap(),
position: self._fields.1.unwrap(),
rotation: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod layout_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Floor;
type Furnishings;
type CreatedAt;
type Wall;
type Size;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Floor = Unset;
type Furnishings = Unset;
type CreatedAt = Unset;
type Wall = Unset;
type Size = Unset;
}
pub struct SetFloor<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetFloor<S> {}
impl<S: State> State for SetFloor<S> {
type Floor = Set<members::floor>;
type Furnishings = S::Furnishings;
type CreatedAt = S::CreatedAt;
type Wall = S::Wall;
type Size = S::Size;
}
pub struct SetFurnishings<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetFurnishings<S> {}
impl<S: State> State for SetFurnishings<S> {
type Floor = S::Floor;
type Furnishings = Set<members::furnishings>;
type CreatedAt = S::CreatedAt;
type Wall = S::Wall;
type Size = S::Size;
}
pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
impl<S: State> State for SetCreatedAt<S> {
type Floor = S::Floor;
type Furnishings = S::Furnishings;
type CreatedAt = Set<members::created_at>;
type Wall = S::Wall;
type Size = S::Size;
}
pub struct SetWall<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetWall<S> {}
impl<S: State> State for SetWall<S> {
type Floor = S::Floor;
type Furnishings = S::Furnishings;
type CreatedAt = S::CreatedAt;
type Wall = Set<members::wall>;
type Size = S::Size;
}
pub struct SetSize<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSize<S> {}
impl<S: State> State for SetSize<S> {
type Floor = S::Floor;
type Furnishings = S::Furnishings;
type CreatedAt = S::CreatedAt;
type Wall = S::Wall;
type Size = Set<members::size>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct floor(());
pub struct furnishings(());
pub struct created_at(());
pub struct wall(());
pub struct size(());
}
}
pub struct LayoutBuilder<'a, S: layout_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (
Option<Datetime>,
Option<layout::Floor<'a>>,
Option<Vec<layout::Furnishing<'a>>>,
Option<i64>,
Option<layout::Wall<'a>>,
),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Layout<'a> {
pub fn new() -> LayoutBuilder<'a, layout_state::Empty> {
LayoutBuilder::new()
}
}
impl<'a> LayoutBuilder<'a, layout_state::Empty> {
pub fn new() -> Self {
LayoutBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> LayoutBuilder<'a, S>
where
S: layout_state::State,
S::CreatedAt: layout_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> LayoutBuilder<'a, layout_state::SetCreatedAt<S>> {
self._fields.0 = Option::Some(value.into());
LayoutBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> LayoutBuilder<'a, S>
where
S: layout_state::State,
S::Floor: layout_state::IsUnset,
{
pub fn floor(
mut self,
value: impl Into<layout::Floor<'a>>,
) -> LayoutBuilder<'a, layout_state::SetFloor<S>> {
self._fields.1 = Option::Some(value.into());
LayoutBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> LayoutBuilder<'a, S>
where
S: layout_state::State,
S::Furnishings: layout_state::IsUnset,
{
pub fn furnishings(
mut self,
value: impl Into<Vec<layout::Furnishing<'a>>>,
) -> LayoutBuilder<'a, layout_state::SetFurnishings<S>> {
self._fields.2 = Option::Some(value.into());
LayoutBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> LayoutBuilder<'a, S>
where
S: layout_state::State,
S::Size: layout_state::IsUnset,
{
pub fn size(
mut self,
value: impl Into<i64>,
) -> LayoutBuilder<'a, layout_state::SetSize<S>> {
self._fields.3 = Option::Some(value.into());
LayoutBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> LayoutBuilder<'a, S>
where
S: layout_state::State,
S::Wall: layout_state::IsUnset,
{
pub fn wall(
mut self,
value: impl Into<layout::Wall<'a>>,
) -> LayoutBuilder<'a, layout_state::SetWall<S>> {
self._fields.4 = Option::Some(value.into());
LayoutBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> LayoutBuilder<'a, S>
where
S: layout_state::State,
S::Floor: layout_state::IsSet,
S::Furnishings: layout_state::IsSet,
S::CreatedAt: layout_state::IsSet,
S::Wall: layout_state::IsSet,
S::Size: layout_state::IsSet,
{
pub fn build(self) -> Layout<'a> {
Layout {
created_at: self._fields.0.unwrap(),
floor: self._fields.1.unwrap(),
furnishings: self._fields.2.unwrap(),
size: self._fields.3.unwrap(),
wall: self._fields.4.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Layout<'a> {
Layout {
created_at: self._fields.0.unwrap(),
floor: self._fields.1.unwrap(),
furnishings: self._fields.2.unwrap(),
size: self._fields.3.unwrap(),
wall: self._fields.4.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod surface_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Color;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Color = Unset;
}
pub struct SetColor<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetColor<S> {}
impl<S: State> State for SetColor<S> {
type Color = Set<members::color>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct color(());
}
}
pub struct SurfaceBuilder<'a, S: surface_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<layout::Color<'a>>, Option<CowStr<'a>>, Option<Vec<i64>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Surface<'a> {
pub fn new() -> SurfaceBuilder<'a, surface_state::Empty> {
SurfaceBuilder::new()
}
}
impl<'a> SurfaceBuilder<'a, surface_state::Empty> {
pub fn new() -> Self {
SurfaceBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> SurfaceBuilder<'a, S>
where
S: surface_state::State,
S::Color: surface_state::IsUnset,
{
pub fn color(
mut self,
value: impl Into<layout::Color<'a>>,
) -> SurfaceBuilder<'a, surface_state::SetColor<S>> {
self._fields.0 = Option::Some(value.into());
SurfaceBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S: surface_state::State> SurfaceBuilder<'a, S> {
pub fn texture(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_texture(mut self, value: Option<CowStr<'a>>) -> Self {
self._fields.1 = value;
self
}
}
impl<'a, S: surface_state::State> SurfaceBuilder<'a, S> {
pub fn texture_tiling(mut self, value: impl Into<Option<Vec<i64>>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_texture_tiling(mut self, value: Option<Vec<i64>>) -> Self {
self._fields.2 = value;
self
}
}
impl<'a, S> SurfaceBuilder<'a, S>
where
S: surface_state::State,
S::Color: surface_state::IsSet,
{
pub fn build(self) -> Surface<'a> {
Surface {
color: self._fields.0.unwrap(),
texture: self._fields.1,
texture_tiling: self._fields.2,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Surface<'a> {
Surface {
color: self._fields.0.unwrap(),
texture: self._fields.1,
texture_tiling: self._fields.2,
extra_data: Some(extra_data),
}
}
}
pub mod wall_state {
pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
#[allow(unused)]
use ::core::marker::PhantomData;
mod sealed {
pub trait Sealed {}
}
pub trait State: sealed::Sealed {
type Thickness;
type Surface;
type Height;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Thickness = Unset;
type Surface = Unset;
type Height = Unset;
}
pub struct SetThickness<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetThickness<S> {}
impl<S: State> State for SetThickness<S> {
type Thickness = Set<members::thickness>;
type Surface = S::Surface;
type Height = S::Height;
}
pub struct SetSurface<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSurface<S> {}
impl<S: State> State for SetSurface<S> {
type Thickness = S::Thickness;
type Surface = Set<members::surface>;
type Height = S::Height;
}
pub struct SetHeight<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetHeight<S> {}
impl<S: State> State for SetHeight<S> {
type Thickness = S::Thickness;
type Surface = S::Surface;
type Height = Set<members::height>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct thickness(());
pub struct surface(());
pub struct height(());
}
}
pub struct WallBuilder<'a, S: wall_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<i64>, Option<layout::Surface<'a>>, Option<i64>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> Wall<'a> {
pub fn new() -> WallBuilder<'a, wall_state::Empty> {
WallBuilder::new()
}
}
impl<'a> WallBuilder<'a, wall_state::Empty> {
pub fn new() -> Self {
WallBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> WallBuilder<'a, S>
where
S: wall_state::State,
S::Height: wall_state::IsUnset,
{
pub fn height(
mut self,
value: impl Into<i64>,
) -> WallBuilder<'a, wall_state::SetHeight<S>> {
self._fields.0 = Option::Some(value.into());
WallBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> WallBuilder<'a, S>
where
S: wall_state::State,
S::Surface: wall_state::IsUnset,
{
pub fn surface(
mut self,
value: impl Into<layout::Surface<'a>>,
) -> WallBuilder<'a, wall_state::SetSurface<S>> {
self._fields.1 = Option::Some(value.into());
WallBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> WallBuilder<'a, S>
where
S: wall_state::State,
S::Thickness: wall_state::IsUnset,
{
pub fn thickness(
mut self,
value: impl Into<i64>,
) -> WallBuilder<'a, wall_state::SetThickness<S>> {
self._fields.2 = Option::Some(value.into());
WallBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> WallBuilder<'a, S>
where
S: wall_state::State,
S::Thickness: wall_state::IsSet,
S::Surface: wall_state::IsSet,
S::Height: wall_state::IsSet,
{
pub fn build(self) -> Wall<'a> {
Wall {
height: self._fields.0.unwrap(),
surface: self._fields.1.unwrap(),
thickness: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Wall<'a> {
Wall {
height: self._fields.0.unwrap(),
surface: self._fields.1.unwrap(),
thickness: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}