[][src]Struct azul_core::dom::Dom

pub struct Dom {
    pub root: NodeData,
    pub children: Vec<Dom>,
    // some fields omitted
}

The document model, similar to HTML. This is a create-only structure, you don't actually read anything back

Fields

root: NodeDatachildren: Vec<Dom>

Implementations

impl Dom[src]

pub const fn new(node_type: NodeType) -> Self[src]

Creates an empty DOM with a give NodeType. Note: This is a const fn and doesn't allocate, it only allocates once you add at least one child node.

pub fn with_capacity(node_type: NodeType, cap: usize) -> Self[src]

Creates an empty DOM with space reserved for cap nodes

pub const fn div() -> Self[src]

Shorthand for Dom::new(NodeType::Div).

pub const fn body() -> Self[src]

Shorthand for Dom::new(NodeType::Body).

pub fn label<S: Into<DomString>>(value: S) -> Self[src]

Shorthand for Dom::new(NodeType::Label(value.into()))

pub const fn text_id(text_id: TextId) -> Self[src]

Shorthand for Dom::new(NodeType::Text(text_id))

pub const fn image(image: ImageId) -> Self[src]

Shorthand for Dom::new(NodeType::Image(image_id))

pub fn gl_texture<I: Into<RefAny>>(callback: GlCallbackType, ptr: I) -> Self[src]

Shorthand for Dom::new(NodeType::GlTexture((callback, ptr)))

pub fn iframe<I: Into<RefAny>>(callback: IFrameCallbackType, ptr: I) -> Self[src]

Shorthand for Dom::new(NodeType::IFrame((callback, ptr)))

pub fn add_child(&mut self, child: Self)[src]

Adds a child DOM to the current DOM

pub fn with_id<S: Into<DomString>>(self, id: S) -> Self[src]

Same as id, but easier to use for method chaining in a builder-style pattern

pub fn with_class<S: Into<DomString>>(self, class: S) -> Self[src]

Same as id, but easier to use for method chaining in a builder-style pattern

pub fn with_callback<O: Into<EventFilter>>(
    self,
    on: O,
    callback: CallbackType,
    ptr: RefAny
) -> Self
[src]

Same as event, but easier to use for method chaining in a builder-style pattern

pub fn with_child(self, child: Self) -> Self[src]

pub fn with_css_override<S: Into<DomString>>(
    self,
    id: S,
    property: CssProperty
) -> Self
[src]

pub fn with_tab_index(self, tab_index: TabIndex) -> Self[src]

pub fn is_draggable(self, draggable: bool) -> Self[src]

pub fn add_id<S: Into<DomString>>(&mut self, id: S)[src]

pub fn add_class<S: Into<DomString>>(&mut self, class: S)[src]

pub fn add_callback<O: Into<EventFilter>>(
    &mut self,
    on: O,
    callback: CallbackType,
    ptr: RefAny
)
[src]

pub fn add_css_override<S: Into<DomString>, P: Into<CssProperty>>(
    &mut self,
    override_id: S,
    property: P
)
[src]

pub fn set_tab_index(&mut self, tab_index: TabIndex)[src]

pub fn set_draggable(&mut self, draggable: bool)[src]

pub fn get_html_string(&self) -> String[src]

Returns a HTML-formatted version of the DOM for easier debugging, i.e.

This example is not tested
Dom::div().with_id("hello")
    .with_child(Dom::div().with_id("test"))

will return:

<div id="hello">
     <div id="test" />
</div>

Trait Implementations

impl Clone for Dom[src]

impl Debug for Dom[src]

impl Eq for Dom[src]

impl From<Dom> for CompactDom[src]

impl FromIterator<Dom> for Dom[src]

impl FromIterator<NodeData> for Dom[src]

impl FromIterator<NodeType> for Dom[src]

impl PartialEq<Dom> for Dom[src]

Auto Trait Implementations

impl !RefUnwindSafe for Dom

impl !Send for Dom

impl !Sync for Dom

impl Unpin for Dom

impl !UnwindSafe for Dom

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.