sycamore::web

Enum SsrNode

pub enum SsrNode {
    Element {
        tag: Cow<'static, str>,
        attributes: Vec<(Cow<'static, str>, Cow<'static, str>)>,
        bool_attributes: Vec<(Cow<'static, str>, bool)>,
        children: Vec<SsrNode>,
        inner_html: Option<Box<Cow<'static, str>>>,
        hk_key: Option<HydrationKey>,
    },
    TextDynamic {
        text: Cow<'static, str>,
    },
    TextStatic {
        text: Cow<'static, str>,
    },
    Marker,
    Dynamic {
        view: Arc<Mutex<View>>,
    },
    SuspenseMarker {
        key: u32,
    },
}

Variants§

§

Element

Fields

§tag: Cow<'static, str>
§attributes: Vec<(Cow<'static, str>, Cow<'static, str>)>
§bool_attributes: Vec<(Cow<'static, str>, bool)>
§children: Vec<SsrNode>
§inner_html: Option<Box<Cow<'static, str>>>
§

TextDynamic

Fields

§text: Cow<'static, str>
§

TextStatic

Fields

§text: Cow<'static, str>
§

Marker

§

Dynamic

SSR by default does not update to any dynamic changes in the view. This special node allows dynamically changing the view tree before it is rendered.

This is used for updating the view with suspense content once it is resolved.

Fields

§view: Arc<Mutex<View>>
§

SuspenseMarker

Fields

§key: u32

Trait Implementations§

§

impl From<SsrNode> for View

§

fn from(node: SsrNode) -> View

Converts to this type from the input type.
§

impl ViewHtmlNode for SsrNode

§

fn create_element(tag: Cow<'static, str>) -> SsrNode

Create a new HTML element.
§

fn create_element_ns(_namespace: &str, tag: Cow<'static, str>) -> SsrNode

Create a new HTML element with a XML namespace.
§

fn create_text_node(text: Cow<'static, str>) -> SsrNode

Create a new HTML text node.
§

fn create_dynamic_text_node(text: Cow<'static, str>) -> SsrNode

Create a new HTML text node whose value will be changed dynamically.
§

fn create_marker_node() -> SsrNode

Create a new HTML marker (comment) node.
§

fn set_attribute( &mut self, name: Cow<'static, str>, value: MaybeDyn<Option<Cow<'static, str>>>, )

Set an HTML attribute.
§

fn set_bool_attribute(&mut self, name: Cow<'static, str>, value: MaybeDyn<bool>)

Set a boolean HTML attribute.
§

fn set_property(&mut self, _name: Cow<'static, str>, _value: MaybeDyn<JsValue>)

Set a JS property on an element.
§

fn set_event_handler( &mut self, _name: Cow<'static, str>, _handler: impl FnMut(Event) + 'static, )

Set an event handler on an element.
§

fn set_inner_html(&mut self, inner_html: Cow<'static, str>)

Set the inner HTML value of an element.
§

fn as_web_sys(&self) -> &Node

Return the raw web-sys node.
§

fn from_web_sys(_node: Node) -> SsrNode

Wrap a raw web-sys node.
§

impl ViewNode for SsrNode

§

fn append_child(&mut self, child: SsrNode)

Appends a child to the node. Panics if the node is not an element or other node that can have children (e.g. text node).
§

fn create_dynamic_view<U>(f: impl FnMut() -> U + 'static) -> View
where U: Into<View> + 'static,

Create a dynamic view from a function that returns a view. Read more
§

fn append_view(&mut self, view: View<Self>)

Append a view to this node. Since a view is just a list of nodes, this essentially appends every node in the view to this node.

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.