Skip to main content

Placement

Struct Placement 

Source
pub struct Placement {
Show 17 fields pub prefab: StructuredId, pub name: String, pub kind: Option<String>, pub class: Vec<String>, pub position: [f32; 3], pub rotation: [f32; 4], pub scale: [f32; 3], pub codex: Option<String>, pub behavior: Option<String>, pub interaction: Option<Interaction>, pub text: Option<TextPanel>, pub animate: Option<Animate>, pub solid: Option<bool>, pub light: Option<LightEmitter>, pub data: Value, pub children: Vec<Placement>, pub extra: Extra,
}
Expand description

One placed instance of a prefab.

Fields§

§prefab: StructuredId§name: String§kind: Option<String>

Semantic tag for styles type selectors (“tree”, “door”, “sign”) — the HTML-element analog. JSON key is type.

§class: Vec<String>

CSS-like classes for styles class selectors (.harvestable).

§position: [f32; 3]§rotation: [f32; 4]§scale: [f32; 3]§codex: Option<String>

Canonical Codex slug for this object — “inspect” surfaces its lore.

§behavior: Option<String>

Id of a Behavior bound to this placement.

§interaction: Option<Interaction>

A codeless interaction — the simple path (no WASM). Name the verb and list what happens. For anything richer, use behavior.

§text: Option<TextPanel>

Readable text rendered ONTO this placement’s surface by the browser — plaques, signs, reading boards. Text as content, not as texture: the manifest carries the words; every browser typesets them itself.

§animate: Option<Animate>

Data-driven idle motion, executed by the browser’s native loop — the Thread’s idiom for living worlds (the web’s idiom is app code updating transforms every frame). None = static.

§solid: Option<bool>

Whether this placement blocks movement. Default true; set false for decor a traveler should walk (and jump) through — statues, figures, conjured motes. A curved decorative collider is how you get bounced into the sky.

§light: Option<LightEmitter>

This placement emits light — a point light at its position. Lamps, torches, and stage lights are content, not renderer configuration; the browser’s lighting pass honors them. None = not a light source.

§data: Value

Arbitrary per-placement data (e.g. a product id + price for commerce).

§children: Vec<Placement>

Child placements, positioned relative to this one (the tree / DOM model). Their transforms compose with this placement’s, so you build scenes by containment — a table with a lamp on it — instead of absolute coordinates. Defaults to none (a flat world is just a forest of depth 1).

§extra: Extra

Unknown fields, preserved across a round trip (see Extra).

Implementations§

Source§

impl Placement

Source

pub fn iter_tree(&self) -> impl Iterator<Item = &Placement>

This placement and all its descendants, depth-first (parent before children). Transform composition is the renderer’s job; this is the flat list for reference checks and iteration.

Trait Implementations§

Source§

impl Clone for Placement

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Placement

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Placement

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Placement

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.