Struct rbx_dom_weak::InstanceBuilder [−][src]
pub struct InstanceBuilder { /* fields omitted */ }
Expand description
Represents an instance that can be turned into a new
WeakDom
, or inserted into an existing one.
Examples
Instances have the given ClassName and Name and no properties by default.
use rbx_dom_weak::{InstanceBuilder, WeakDom}; let data_model = InstanceBuilder::new("DataModel"); let dom = WeakDom::new(data_model);
Properties and children can be added to the builder.
use rbx_dom_weak::{InstanceBuilder, WeakDom}; use rbx_dom_weak::types::Color3; let data_model = InstanceBuilder::new("DataModel") .with_child(InstanceBuilder::new("Workspace") .with_property("FilteringEnabled", true)) .with_child(InstanceBuilder::new("Lighting") .with_property("Ambient", Color3::new(1.0, 0.0, 0.0))); let dom = WeakDom::new(data_model);
Implementations
Create a new InstanceBuilder
with the given ClassName. This is also
used as the instance’s Name, unless overwritten later.
Return the referent of the instance that the InstanceBuilder
refers to.
Change the name of the InstanceBuilder
.
Add a new property to the InstanceBuilder
.
Add a new property to the InstanceBuilder
.
pub fn with_properties<K, V, I>(self, props: I) -> Self where
K: Into<String>,
V: Into<Variant>,
I: IntoIterator<Item = (K, V)>,
pub fn with_properties<K, V, I>(self, props: I) -> Self where
K: Into<String>,
V: Into<Variant>,
I: IntoIterator<Item = (K, V)>,
Add multiple properties to the InstanceBuilder
at once.
pub fn add_properties<K, V, I>(&mut self, props: I) where
K: Into<String>,
V: Into<Variant>,
I: IntoIterator<Item = (K, V)>,
pub fn add_properties<K, V, I>(&mut self, props: I) where
K: Into<String>,
V: Into<Variant>,
I: IntoIterator<Item = (K, V)>,
Add multiple properties to the InstanceBuilder
at once.
Add a new child to the InstanceBuilder
.
Add a new child to the InstanceBuilder
.
pub fn with_children<I>(self, children: I) -> Self where
I: IntoIterator<Item = InstanceBuilder>,
pub fn with_children<I>(self, children: I) -> Self where
I: IntoIterator<Item = InstanceBuilder>,
Add multiple children to the InstanceBuilder
at once.
Order of the children will be preserved.
Add multiple children to the InstanceBuilder
at once.
Order of the children will be preserved.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for InstanceBuilder
impl Send for InstanceBuilder
impl Sync for InstanceBuilder
impl Unpin for InstanceBuilder
impl UnwindSafe for InstanceBuilder