Enum leptos_dom::View
source · pub enum View {
Element(Element),
Text(Text),
Component(ComponentRepr),
CoreComponent(CoreComponent),
Transparent(Transparent),
Suspense(HydrationKey, CoreComponent),
}
Expand description
A leptos view which can be mounted to the DOM.
Variants§
Element(Element)
HTML element node.
Text(Text)
HTML text node.
Component(ComponentRepr)
Custom leptos component.
CoreComponent(CoreComponent)
leptos core-component.
Transparent(Transparent)
Wraps arbitrary data that’s not part of the view but is passed via the view tree.
Suspense(HydrationKey, CoreComponent)
Marks the contents of Suspense component, which can be replaced in streaming SSR.
Implementations§
source§impl View
impl View
sourcepub fn render_to_string(self) -> Oco<'static, str>
pub fn render_to_string(self) -> Oco<'static, str>
Consumes the node and renders it into an HTML string.
This is NOT the same as render_to_string
. This
functions differs in that it assumes a runtime is in scope.
render_to_string
creates, and disposes of a runtime for you.
§Panics
When called in a scope without a runtime. Use render_to_string
instead.
source§impl View
impl View
sourcepub fn into_stream_chunks(self) -> VecDeque<StreamChunk>
pub fn into_stream_chunks(self) -> VecDeque<StreamChunk>
Renders the view into a set of HTML chunks that can be streamed.
source§impl View
impl View
sourcepub fn as_element(&self) -> Option<&Element>
pub fn as_element(&self) -> Option<&Element>
sourcepub fn as_transparent(&self) -> Option<&Transparent>
pub fn as_transparent(&self) -> Option<&Transparent>
Returns Some
Transparent
if the view is of this type. None
otherwise.
sourcepub fn into_html_element(self) -> Result<HtmlElement<AnyElement>, Self>
pub fn into_html_element(self) -> Result<HtmlElement<AnyElement>, Self>
sourcepub fn on<E: EventDescriptor + 'static>(
self,
event: E,
event_handler: impl FnMut(E::EventType) + 'static
) -> Self
pub fn on<E: EventDescriptor + 'static>( self, event: E, event_handler: impl FnMut(E::EventType) + 'static ) -> Self
Adds an event listener, analogous to HtmlElement::on
.
This method will attach an event listener to all children
sourcepub fn directive<T, P>(
self,
handler: impl Directive<T, P> + 'static,
param: P
) -> Self
pub fn directive<T, P>( self, handler: impl Directive<T, P> + 'static, param: P ) -> Self
Adds a directive analogous to HtmlElement::directive
.
This method will attach directive to all child
HtmlElement
children.
Trait Implementations§
source§impl DOMEventResponder for View
impl DOMEventResponder for View
source§fn add<E: EventDescriptor + 'static>(
self,
event: E,
handler: impl FnMut(E::EventType) + 'static
) -> Self
fn add<E: EventDescriptor + 'static>( self, event: E, handler: impl FnMut(E::EventType) + 'static ) -> Self
source§fn add_handler(self, handler: impl EventHandler) -> Self
fn add_handler(self, handler: impl EventHandler) -> Self
EventHandler
source§impl From<ComponentRepr> for View
impl From<ComponentRepr> for View
source§fn from(value: ComponentRepr) -> Self
fn from(value: ComponentRepr) -> Self
source§impl FromIterator<View> for Fragment
impl FromIterator<View> for Fragment
source§impl FromIterator<View> for View
impl FromIterator<View> for View
source§impl PartialEq for View
impl PartialEq for View
impl Eq for View
impl StructuralPartialEq for View
Auto Trait Implementations§
impl Freeze for View
impl !RefUnwindSafe for View
impl !Send for View
impl !Sync for View
impl Unpin for View
impl !UnwindSafe for View
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.