#[allow(unused_imports)]
use alloc::collections::BTreeMap;
#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};
#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
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::types::value::Data;
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;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Color<S: BosStr = DefaultStr> {
pub blue: i64,
pub green: i64,
pub red: i64,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Floor<S: BosStr = DefaultStr> {
pub surface: layout::Surface<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Furnishing<S: BosStr = DefaultStr> {
pub object: StrongRef<S>,
pub position: Vec<i64>,
pub rotation: Vec<i64>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(
rename_all = "camelCase",
rename = "blue.atroom.room.layout",
tag = "$type",
bound(deserialize = "S: Deserialize<'de> + BosStr")
)]
pub struct Layout<S: BosStr = DefaultStr> {
pub created_at: Datetime,
pub floor: layout::Floor<S>,
pub furnishings: Vec<layout::Furnishing<S>>,
pub size: i64,
pub wall: layout::Wall<S>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct LayoutGetRecordOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub cid: Option<Cid<S>>,
pub uri: AtUri<S>,
pub value: Layout<S>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Surface<S: BosStr = DefaultStr> {
pub color: layout::Color<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub texture: Option<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub texture_tiling: Option<Vec<i64>>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Wall<S: BosStr = DefaultStr> {
pub height: i64,
pub surface: layout::Surface<S>,
pub thickness: i64,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> Layout<S> {
pub fn uri(uri: S) -> Result<RecordUri<S, LayoutRecord>, UriError> {
RecordUri::try_from_uri(AtUri::new(uri)?)
}
}
impl<S: BosStr> LexiconSchema for Color<S> {
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<S: BosStr> LexiconSchema for Floor<S> {
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<S: BosStr> LexiconSchema for Furnishing<S> {
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<S: BosStr> = LayoutGetRecordOutput<S>;
type Err = RecordError;
}
impl<S: BosStr> From<LayoutGetRecordOutput<S>> for Layout<S> {
fn from(output: LayoutGetRecordOutput<S>) -> Self {
output.value
}
}
impl<S: BosStr> Collection for Layout<S> {
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<S: BosStr> LexiconSchema for Layout<S> {
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<S: BosStr> LexiconSchema for Surface<S> {
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<S: BosStr> LexiconSchema for Wall<S> {
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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRed<St> {}
impl<St: State> State for SetRed<St> {
type Red = Set<members::red>;
type Green = St::Green;
type Blue = St::Blue;
}
pub struct SetGreen<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetGreen<St> {}
impl<St: State> State for SetGreen<St> {
type Red = St::Red;
type Green = Set<members::green>;
type Blue = St::Blue;
}
pub struct SetBlue<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetBlue<St> {}
impl<St: State> State for SetBlue<St> {
type Red = St::Red;
type Green = St::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<S: BosStr, St: color_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<i64>, Option<i64>, Option<i64>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Color<S> {
pub fn new() -> ColorBuilder<S, color_state::Empty> {
ColorBuilder::new()
}
}
impl<S: BosStr> ColorBuilder<S, color_state::Empty> {
pub fn new() -> Self {
ColorBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ColorBuilder<S, St>
where
St: color_state::State,
St::Blue: color_state::IsUnset,
{
pub fn blue(
mut self,
value: impl Into<i64>,
) -> ColorBuilder<S, color_state::SetBlue<St>> {
self._fields.0 = Option::Some(value.into());
ColorBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ColorBuilder<S, St>
where
St: color_state::State,
St::Green: color_state::IsUnset,
{
pub fn green(
mut self,
value: impl Into<i64>,
) -> ColorBuilder<S, color_state::SetGreen<St>> {
self._fields.1 = Option::Some(value.into());
ColorBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ColorBuilder<S, St>
where
St: color_state::State,
St::Red: color_state::IsUnset,
{
pub fn red(
mut self,
value: impl Into<i64>,
) -> ColorBuilder<S, color_state::SetRed<St>> {
self._fields.2 = Option::Some(value.into());
ColorBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> ColorBuilder<S, St>
where
St: color_state::State,
St::Red: color_state::IsSet,
St::Green: color_state::IsSet,
St::Blue: color_state::IsSet,
{
pub fn build(self) -> Color<S> {
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<SmolStr, Data<S>>) -> Color<S> {
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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSurface<St> {}
impl<St: State> State for SetSurface<St> {
type Surface = Set<members::surface>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct surface(());
}
}
pub struct FloorBuilder<S: BosStr, St: floor_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<layout::Surface<S>>,),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Floor<S> {
pub fn new() -> FloorBuilder<S, floor_state::Empty> {
FloorBuilder::new()
}
}
impl<S: BosStr> FloorBuilder<S, floor_state::Empty> {
pub fn new() -> Self {
FloorBuilder {
_state: PhantomData,
_fields: (None,),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FloorBuilder<S, St>
where
St: floor_state::State,
St::Surface: floor_state::IsUnset,
{
pub fn surface(
mut self,
value: impl Into<layout::Surface<S>>,
) -> FloorBuilder<S, floor_state::SetSurface<St>> {
self._fields.0 = Option::Some(value.into());
FloorBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FloorBuilder<S, St>
where
St: floor_state::State,
St::Surface: floor_state::IsSet,
{
pub fn build(self) -> Floor<S> {
Floor {
surface: self._fields.0.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Floor<S> {
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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRotation<St> {}
impl<St: State> State for SetRotation<St> {
type Rotation = Set<members::rotation>;
type Position = St::Position;
type Object = St::Object;
}
pub struct SetPosition<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetPosition<St> {}
impl<St: State> State for SetPosition<St> {
type Rotation = St::Rotation;
type Position = Set<members::position>;
type Object = St::Object;
}
pub struct SetObject<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetObject<St> {}
impl<St: State> State for SetObject<St> {
type Rotation = St::Rotation;
type Position = St::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<S: BosStr, St: furnishing_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<StrongRef<S>>, Option<Vec<i64>>, Option<Vec<i64>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Furnishing<S> {
pub fn new() -> FurnishingBuilder<S, furnishing_state::Empty> {
FurnishingBuilder::new()
}
}
impl<S: BosStr> FurnishingBuilder<S, furnishing_state::Empty> {
pub fn new() -> Self {
FurnishingBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FurnishingBuilder<S, St>
where
St: furnishing_state::State,
St::Object: furnishing_state::IsUnset,
{
pub fn object(
mut self,
value: impl Into<StrongRef<S>>,
) -> FurnishingBuilder<S, furnishing_state::SetObject<St>> {
self._fields.0 = Option::Some(value.into());
FurnishingBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FurnishingBuilder<S, St>
where
St: furnishing_state::State,
St::Position: furnishing_state::IsUnset,
{
pub fn position(
mut self,
value: impl Into<Vec<i64>>,
) -> FurnishingBuilder<S, furnishing_state::SetPosition<St>> {
self._fields.1 = Option::Some(value.into());
FurnishingBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FurnishingBuilder<S, St>
where
St: furnishing_state::State,
St::Rotation: furnishing_state::IsUnset,
{
pub fn rotation(
mut self,
value: impl Into<Vec<i64>>,
) -> FurnishingBuilder<S, furnishing_state::SetRotation<St>> {
self._fields.2 = Option::Some(value.into());
FurnishingBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> FurnishingBuilder<S, St>
where
St: furnishing_state::State,
St::Rotation: furnishing_state::IsSet,
St::Position: furnishing_state::IsSet,
St::Object: furnishing_state::IsSet,
{
pub fn build(self) -> Furnishing<S> {
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<SmolStr, Data<S>>,
) -> Furnishing<S> {
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 CreatedAt;
type Furnishings;
type Size;
type Wall;
type Floor;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type CreatedAt = Unset;
type Furnishings = Unset;
type Size = Unset;
type Wall = Unset;
type Floor = Unset;
}
pub struct SetCreatedAt<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetCreatedAt<St> {}
impl<St: State> State for SetCreatedAt<St> {
type CreatedAt = Set<members::created_at>;
type Furnishings = St::Furnishings;
type Size = St::Size;
type Wall = St::Wall;
type Floor = St::Floor;
}
pub struct SetFurnishings<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetFurnishings<St> {}
impl<St: State> State for SetFurnishings<St> {
type CreatedAt = St::CreatedAt;
type Furnishings = Set<members::furnishings>;
type Size = St::Size;
type Wall = St::Wall;
type Floor = St::Floor;
}
pub struct SetSize<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSize<St> {}
impl<St: State> State for SetSize<St> {
type CreatedAt = St::CreatedAt;
type Furnishings = St::Furnishings;
type Size = Set<members::size>;
type Wall = St::Wall;
type Floor = St::Floor;
}
pub struct SetWall<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetWall<St> {}
impl<St: State> State for SetWall<St> {
type CreatedAt = St::CreatedAt;
type Furnishings = St::Furnishings;
type Size = St::Size;
type Wall = Set<members::wall>;
type Floor = St::Floor;
}
pub struct SetFloor<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetFloor<St> {}
impl<St: State> State for SetFloor<St> {
type CreatedAt = St::CreatedAt;
type Furnishings = St::Furnishings;
type Size = St::Size;
type Wall = St::Wall;
type Floor = Set<members::floor>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct created_at(());
pub struct furnishings(());
pub struct size(());
pub struct wall(());
pub struct floor(());
}
}
pub struct LayoutBuilder<S: BosStr, St: layout_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<Datetime>,
Option<layout::Floor<S>>,
Option<Vec<layout::Furnishing<S>>>,
Option<i64>,
Option<layout::Wall<S>>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Layout<S> {
pub fn new() -> LayoutBuilder<S, layout_state::Empty> {
LayoutBuilder::new()
}
}
impl<S: BosStr> LayoutBuilder<S, layout_state::Empty> {
pub fn new() -> Self {
LayoutBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LayoutBuilder<S, St>
where
St: layout_state::State,
St::CreatedAt: layout_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<Datetime>,
) -> LayoutBuilder<S, layout_state::SetCreatedAt<St>> {
self._fields.0 = Option::Some(value.into());
LayoutBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LayoutBuilder<S, St>
where
St: layout_state::State,
St::Floor: layout_state::IsUnset,
{
pub fn floor(
mut self,
value: impl Into<layout::Floor<S>>,
) -> LayoutBuilder<S, layout_state::SetFloor<St>> {
self._fields.1 = Option::Some(value.into());
LayoutBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LayoutBuilder<S, St>
where
St: layout_state::State,
St::Furnishings: layout_state::IsUnset,
{
pub fn furnishings(
mut self,
value: impl Into<Vec<layout::Furnishing<S>>>,
) -> LayoutBuilder<S, layout_state::SetFurnishings<St>> {
self._fields.2 = Option::Some(value.into());
LayoutBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LayoutBuilder<S, St>
where
St: layout_state::State,
St::Size: layout_state::IsUnset,
{
pub fn size(
mut self,
value: impl Into<i64>,
) -> LayoutBuilder<S, layout_state::SetSize<St>> {
self._fields.3 = Option::Some(value.into());
LayoutBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LayoutBuilder<S, St>
where
St: layout_state::State,
St::Wall: layout_state::IsUnset,
{
pub fn wall(
mut self,
value: impl Into<layout::Wall<S>>,
) -> LayoutBuilder<S, layout_state::SetWall<St>> {
self._fields.4 = Option::Some(value.into());
LayoutBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> LayoutBuilder<S, St>
where
St: layout_state::State,
St::CreatedAt: layout_state::IsSet,
St::Furnishings: layout_state::IsSet,
St::Size: layout_state::IsSet,
St::Wall: layout_state::IsSet,
St::Floor: layout_state::IsSet,
{
pub fn build(self) -> Layout<S> {
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<SmolStr, Data<S>>) -> Layout<S> {
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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetColor<St> {}
impl<St: State> State for SetColor<St> {
type Color = Set<members::color>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct color(());
}
}
pub struct SurfaceBuilder<S: BosStr, St: surface_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<layout::Color<S>>, Option<S>, Option<Vec<i64>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Surface<S> {
pub fn new() -> SurfaceBuilder<S, surface_state::Empty> {
SurfaceBuilder::new()
}
}
impl<S: BosStr> SurfaceBuilder<S, surface_state::Empty> {
pub fn new() -> Self {
SurfaceBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> SurfaceBuilder<S, St>
where
St: surface_state::State,
St::Color: surface_state::IsUnset,
{
pub fn color(
mut self,
value: impl Into<layout::Color<S>>,
) -> SurfaceBuilder<S, surface_state::SetColor<St>> {
self._fields.0 = Option::Some(value.into());
SurfaceBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: surface_state::State> SurfaceBuilder<S, St> {
pub fn texture(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_texture(mut self, value: Option<S>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St: surface_state::State> SurfaceBuilder<S, St> {
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<S: BosStr, St> SurfaceBuilder<S, St>
where
St: surface_state::State,
St::Color: surface_state::IsSet,
{
pub fn build(self) -> Surface<S> {
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<SmolStr, Data<S>>) -> Surface<S> {
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<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetThickness<St> {}
impl<St: State> State for SetThickness<St> {
type Thickness = Set<members::thickness>;
type Surface = St::Surface;
type Height = St::Height;
}
pub struct SetSurface<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSurface<St> {}
impl<St: State> State for SetSurface<St> {
type Thickness = St::Thickness;
type Surface = Set<members::surface>;
type Height = St::Height;
}
pub struct SetHeight<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetHeight<St> {}
impl<St: State> State for SetHeight<St> {
type Thickness = St::Thickness;
type Surface = St::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<S: BosStr, St: wall_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<i64>, Option<layout::Surface<S>>, Option<i64>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Wall<S> {
pub fn new() -> WallBuilder<S, wall_state::Empty> {
WallBuilder::new()
}
}
impl<S: BosStr> WallBuilder<S, wall_state::Empty> {
pub fn new() -> Self {
WallBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> WallBuilder<S, St>
where
St: wall_state::State,
St::Height: wall_state::IsUnset,
{
pub fn height(
mut self,
value: impl Into<i64>,
) -> WallBuilder<S, wall_state::SetHeight<St>> {
self._fields.0 = Option::Some(value.into());
WallBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> WallBuilder<S, St>
where
St: wall_state::State,
St::Surface: wall_state::IsUnset,
{
pub fn surface(
mut self,
value: impl Into<layout::Surface<S>>,
) -> WallBuilder<S, wall_state::SetSurface<St>> {
self._fields.1 = Option::Some(value.into());
WallBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> WallBuilder<S, St>
where
St: wall_state::State,
St::Thickness: wall_state::IsUnset,
{
pub fn thickness(
mut self,
value: impl Into<i64>,
) -> WallBuilder<S, wall_state::SetThickness<St>> {
self._fields.2 = Option::Some(value.into());
WallBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> WallBuilder<S, St>
where
St: wall_state::State,
St::Thickness: wall_state::IsSet,
St::Surface: wall_state::IsSet,
St::Height: wall_state::IsSet,
{
pub fn build(self) -> Wall<S> {
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<SmolStr, Data<S>>) -> Wall<S> {
Wall {
height: self._fields.0.unwrap(),
surface: self._fields.1.unwrap(),
thickness: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}