ClassBuilder

Struct ClassBuilder 

Source
pub struct ClassBuilder {
    pub name: String,
    pub parent: String,
    pub attrs: IndexMap<String, Attr>,
    pub subclasses: SubclassesSpecifier,
    pub hierarchy: Vec<String>,
    pub collects: Vec<CollectionSpecifier>,
    pub html_body: Option<String>,
    pub html_header: Option<String>,
    /* private fields */
}
Expand description

Provides the toolset required to properly define a Scroll class and is primarily used by the Scroll parser.

Fields§

§name: String§parent: String§attrs: IndexMap<String, Attr>§subclasses: SubclassesSpecifier§hierarchy: Vec<String>§collects: Vec<CollectionSpecifier>§html_body: Option<String>§html_header: Option<String>

Implementations§

Source§

impl ClassBuilder

Source

pub fn new() -> Self

Creates a new ClassBuilder instance.

Source

pub fn name(&mut self, name: &str) -> &mut Self

Sets the name of the class. Adds the name to the hierarchy if not present.

Source

pub fn add_attr(&mut self, key: String, attr: Attr) -> &mut Self

Adds or overrides an attribute for the class.

Source

pub fn html_body(&mut self, body: String) -> &mut Self

Sets the HTML body content for the class.

Source

pub fn html_header(&mut self, header: String) -> &mut Self

Sets the HTML body content for the class.

Source

pub fn subclass_item(&mut self, class_name_to_collect: &str)

Specifies the class names to collect as a list of subclasses.

Source

pub fn subclass_var(&mut self, class_name_to_collect: &str)

Specifies a single subclass to collect using a variable.

Source

pub fn collect(&mut self, spec: CollectionSpecifier)

Collects the specified class name.

Source

pub fn expand( &mut self, instance: &SandboxInstance, expand_with_class_name: &str, ) -> &mut Self

Expands the class with attributes from another class using its name.

Source

pub fn extends( &mut self, instance: &SandboxInstance, parent_class_name: &str, ) -> &mut Self

Extends this class with attributes and properties of a parent class.

Source

pub fn conclude(&mut self, instance: &SandboxInstance) -> &mut Self

Applies pending expansions or parent relationships before finalizing the class.

Source

pub fn build(self) -> Class

Finalizes the construction of the class.

Trait Implementations§

Source§

impl Default for ClassBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V