Skip to main content

ElementSource

Struct ElementSource 

Source
pub struct ElementSource {
Show 36 fields pub id: String, pub element_type: String, pub component: Option<String>, pub props: BTreeMap<String, Value>, pub slots: BTreeMap<String, Vec<ElementSource>>, pub x: Option<Length>, pub y: Option<Length>, pub width: Option<Length>, pub height: Option<Length>, pub constraints: LayoutConstraints, pub align_x: Option<Alignment>, pub align_y: Option<Alignment>, pub text: Option<String>, pub text_options: TextSourceOptions, pub table: Option<TableSource>, pub asset: Option<String>, pub image: ImageOptions, pub path: Vec<PathCommandSource>, pub styles: Vec<String>, pub style: StyleSource, pub style_rules: Vec<ElementStyleRuleSource>, pub transform: TransformSource, pub layout: LayoutMode, pub distribute: Distribution, pub gap: Length, pub binding: Option<String>, pub when: Option<String>, pub repeat: Option<String>, pub anchors: BTreeMap<String, String>, pub region: Option<String>, pub children: Vec<ElementSource>, pub locked: bool, pub hidden: bool, pub layer: String, pub z_index: i32, pub collision: Option<CollisionSource>, /* private fields */
}
Expand description

Declarative element frontend.

Fields§

§id: String

Unique stable ID.

§element_type: String

Element type.

§component: Option<String>

Optional component to instantiate.

§props: BTreeMap<String, Value>

Component props.

§slots: BTreeMap<String, Vec<ElementSource>>

Named slot content supplied to a component instance.

§x: Option<Length>

Horizontal source coordinate.

§y: Option<Length>

Vertical source coordinate.

§width: Option<Length>

Source width.

§height: Option<Length>

Source height.

§constraints: LayoutConstraints

Minimum, preferred, maximum, and aspect-ratio size intent.

§align_x: Option<Alignment>

Optional horizontal alignment inside the resolved container.

§align_y: Option<Alignment>

Optional vertical alignment inside the resolved container.

§text: Option<String>

Literal text before binding evaluation.

§text_options: TextSourceOptions

Text overflow, line, minimum-size, and writing-mode intent.

§table: Option<TableSource>

First-class table declaration, valid only for type: table.

§asset: Option<String>

Asset reference.

§image: ImageOptions

Image crop, fit, focal-point, and EXIF behavior.

§path: Vec<PathCommandSource>

Simple vector path commands.

§styles: Vec<String>

Named style references in cascade order.

§style: StyleSource

Inline style.

§style_rules: Vec<ElementStyleRuleSource>

Ordered conditional styles evaluated after the compiled style layers.

§transform: TransformSource

Translation, rotation, scale, flip, mirror, and origin intent.

§layout: LayoutMode

Layout strategy.

§distribute: Distribution

Distribution of children on a flow’s primary axis.

§gap: Length

Gap between flow children.

§binding: Option<String>

Data binding expression.

§when: Option<String>

Visibility condition expression.

§repeat: Option<String>

Repeat array expression.

§anchors: BTreeMap<String, String>

Named anchors.

§region: Option<String>

Named containing region.

§children: Vec<ElementSource>

Child nodes.

§locked: bool

Whether runtime patches may modify this node.

§hidden: bool

Whether the node is initially hidden.

§layer: String

Visual layer.

§z_index: i32

Visual order within a layer.

§collision: Option<CollisionSource>

Collision declaration independent from layer ordering.

Implementations§

Source§

impl ElementSource

Source

pub fn to_ir(&self, limits: &ResourceLimits) -> Result<ElementIr>

Validates and converts one static, self-contained source element to IR.

This compact boundary is suitable for programmatic and tool-driven Canvas additions. Components, props, slots, named or conditional styles, bindings, conditions, and repeats require the complete crate::Compiler pipeline and are rejected here.

Trait Implementations§

Source§

impl Clone for ElementSource

Source§

fn clone(&self) -> ElementSource

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 ElementSource

Source§

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

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

impl<'de> Deserialize<'de> for ElementSource

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 PartialEq for ElementSource

Source§

fn eq(&self, other: &ElementSource) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ElementSource

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
Source§

impl StructuralPartialEq for ElementSource

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> Finish for T

Source§

fn finish(self)

Does nothing but move self, equivalent to drop.
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> Same for T

Source§

type Output = T

Should always be Self
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<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

Source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
Source§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

Source§

fn to_owned_table(&self) -> U

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.