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.

Change the name of the InstanceBuilder.

Add a new property to the InstanceBuilder.

Add a new property to the InstanceBuilder.

Add multiple properties to the InstanceBuilder at once.

Add multiple properties to the InstanceBuilder at once.

Add a new child to the InstanceBuilder.

Add a new child to the 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

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.