Struct PatchElements
pub struct PatchElements {
pub elements: Option<Cow<'static, str>>,
pub selector: Option<SmolStr>,
pub mode: ElementPatchMode,
pub use_view_transition: bool,
}Expand description
PatchElements patches HTML elements into the DOM.
Fields§
§elements: Option<Cow<'static, str>>The elements to be patched into the DOM.
selector: Option<SmolStr>The CSS selector used to patch the elements.
mode: ElementPatchModeThe mode in which elements are patched into the DOM.
If not provided the Datastar client side will default to ElementPatchMode::Outer.
use_view_transition: boolWhether to use view transitions.
If not provided the Datastar client side will default to false.
Implementations§
§impl PatchElements
impl PatchElements
pub const TYPE: EventType = EventType::PatchElements
pub fn new(elements: impl Into<Cow<'static, str>>) -> PatchElements
pub fn new(elements: impl Into<Cow<'static, str>>) -> PatchElements
Create a new PatchElements data blob.
pub fn new_remove(selector: impl Into<SmolStr>) -> PatchElements
pub fn new_remove(selector: impl Into<SmolStr>) -> PatchElements
Create a new PatchElements data blob for removal
pub fn into_sse_event(self) -> Event<PatchElements>
pub fn into_sse_event(self) -> Event<PatchElements>
Consume self as an Event.
pub fn into_datastar_event<T>(self) -> Event<EventData<T>>
pub fn into_datastar_event<T>(self) -> Event<EventData<T>>
Consume self as a super::DatastarEvent.
pub fn with_selector(self, selector: impl Into<SmolStr>) -> PatchElements
pub fn with_selector(self, selector: impl Into<SmolStr>) -> PatchElements
Set the CSS selector used to patch the elements.
pub fn set_selector(
&mut self,
selector: impl Into<SmolStr>,
) -> &mut PatchElements
pub fn set_selector( &mut self, selector: impl Into<SmolStr>, ) -> &mut PatchElements
Set the CSS selector used to patch the elements.
pub fn with_mode(self, mode: ElementPatchMode) -> PatchElements
pub fn with_mode(self, mode: ElementPatchMode) -> PatchElements
Set mode in which elements are patched into the DOM.
pub fn set_mode(&mut self, mode: ElementPatchMode) -> &mut PatchElements
pub fn set_mode(&mut self, mode: ElementPatchMode) -> &mut PatchElements
Set mode in which elements are patched into the DOM.
pub fn with_use_view_transition(
self,
use_view_transition: bool,
) -> PatchElements
pub fn with_use_view_transition( self, use_view_transition: bool, ) -> PatchElements
Sets whether to use view transitions.
pub fn set_use_view_transition(
&mut self,
use_view_transition: bool,
) -> &mut PatchElements
pub fn set_use_view_transition( &mut self, use_view_transition: bool, ) -> &mut PatchElements
Sets whether to use view transitions.
Trait Implementations§
§impl Clone for PatchElements
impl Clone for PatchElements
§fn clone(&self) -> PatchElements
fn clone(&self) -> PatchElements
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for PatchElements
impl Debug for PatchElements
§impl EventDataRead for PatchElements
impl EventDataRead for PatchElements
type Reader = PatchElementsReader
fn line_reader() -> <PatchElements as EventDataRead>::Reader
§impl EventDataWrite for PatchElements
impl EventDataWrite for PatchElements
fn write_data(&self, w: &mut impl Write) -> Result<(), OpaqueError>
§impl<T> From<PatchElements> for Event<EventData<T>>
impl<T> From<PatchElements> for Event<EventData<T>>
§fn from(value: PatchElements) -> Event<EventData<T>>
fn from(value: PatchElements) -> Event<EventData<T>>
§impl From<PatchElements> for Event<PatchElements>
impl From<PatchElements> for Event<PatchElements>
§fn from(value: PatchElements) -> Event<PatchElements>
fn from(value: PatchElements) -> Event<PatchElements>
§impl<T> From<PatchElements> for EventData<T>
impl<T> From<PatchElements> for EventData<T>
§fn from(value: PatchElements) -> EventData<T>
fn from(value: PatchElements) -> EventData<T>
§impl Hash for PatchElements
impl Hash for PatchElements
§impl PartialEq for PatchElements
impl PartialEq for PatchElements
impl Eq for PatchElements
impl StructuralPartialEq for PatchElements
Auto Trait Implementations§
impl Freeze for PatchElements
impl RefUnwindSafe for PatchElements
impl Send for PatchElements
impl Sync for PatchElements
impl Unpin for PatchElements
impl UnwindSafe for PatchElements
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more