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
impl ClassBuilder
Sourcepub fn name(&mut self, name: &str) -> &mut Self
pub fn name(&mut self, name: &str) -> &mut Self
Sets the name of the class. Adds the name to the hierarchy if not present.
Sourcepub fn add_attr(&mut self, key: String, attr: Attr) -> &mut Self
pub fn add_attr(&mut self, key: String, attr: Attr) -> &mut Self
Adds or overrides an attribute for the class.
Sourcepub fn html_body(&mut self, body: String) -> &mut Self
pub fn html_body(&mut self, body: String) -> &mut Self
Sets the HTML body content for the class.
Sourcepub fn html_header(&mut self, header: String) -> &mut Self
pub fn html_header(&mut self, header: String) -> &mut Self
Sets the HTML body content for the class.
Sourcepub fn subclass_item(&mut self, class_name_to_collect: &str)
pub fn subclass_item(&mut self, class_name_to_collect: &str)
Specifies the class names to collect as a list of subclasses.
Sourcepub fn subclass_var(&mut self, class_name_to_collect: &str)
pub fn subclass_var(&mut self, class_name_to_collect: &str)
Specifies a single subclass to collect using a variable.
Sourcepub fn collect(&mut self, spec: CollectionSpecifier)
pub fn collect(&mut self, spec: CollectionSpecifier)
Collects the specified class name.
Sourcepub fn expand(
&mut self,
instance: &SandboxInstance,
expand_with_class_name: &str,
) -> &mut Self
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.
Sourcepub fn extends(
&mut self,
instance: &SandboxInstance,
parent_class_name: &str,
) -> &mut Self
pub fn extends( &mut self, instance: &SandboxInstance, parent_class_name: &str, ) -> &mut Self
Extends this class with attributes and properties of a parent class.
Sourcepub fn conclude(&mut self, instance: &SandboxInstance) -> &mut Self
pub fn conclude(&mut self, instance: &SandboxInstance) -> &mut Self
Applies pending expansions or parent relationships before finalizing the class.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClassBuilder
impl !RefUnwindSafe for ClassBuilder
impl Send for ClassBuilder
impl Sync for ClassBuilder
impl Unpin for ClassBuilder
impl !UnwindSafe for ClassBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more