pub struct PatchSignals<T = String> {
pub signals: T,
pub only_if_missing: bool,
}Expand description
PatchSignals patches signals into the signal store
Fields§
§signals: Tsignals is a JavaScript object or JSON string that
will be sent to the browser to update signals in the signals.
The data must evaluate to a valid JavaScript. It will be converted to signals by the Datastar client side.
only_if_missing: boolWhether to merge the signal only if it does not already exist.
If not provided, the Datastar client side will default to false, which will cause the data to be merged into the signals.
Implementations§
Source§impl<T> PatchSignals<T>
impl<T> PatchSignals<T>
pub const TYPE: EventType = EventType::PatchSignals
Sourcepub fn new(signals: T) -> PatchSignals<T>
pub fn new(signals: T) -> PatchSignals<T>
Create a new PatchSignals data blob.
Sourcepub fn try_into_sse_event(
self,
) -> Result<Event<PatchSignals<T>>, EventBuildError>
pub fn try_into_sse_event( self, ) -> Result<Event<PatchSignals<T>>, EventBuildError>
Consume self as an Event.
Sourcepub fn try_into_datastar_event(
self,
) -> Result<Event<EventData<T>>, EventBuildError>
pub fn try_into_datastar_event( self, ) -> Result<Event<EventData<T>>, EventBuildError>
Consume self as a super::DatastarEvent.
Sourcepub fn with_only_if_missing(self, only_if_missing: bool) -> PatchSignals<T>
pub fn with_only_if_missing(self, only_if_missing: bool) -> PatchSignals<T>
Sets whether to merge the signal only if it does not already exist.
Sourcepub fn set_only_if_missing(
&mut self,
only_if_missing: bool,
) -> &mut PatchSignals<T>
pub fn set_only_if_missing( &mut self, only_if_missing: bool, ) -> &mut PatchSignals<T>
Sets whether to merge the signal only if it does not already exist.
Trait Implementations§
Source§impl<T> Clone for PatchSignals<T>where
T: Clone,
impl<T> Clone for PatchSignals<T>where
T: Clone,
Source§fn clone(&self) -> PatchSignals<T>
fn clone(&self) -> PatchSignals<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T> Debug for PatchSignals<T>where
T: Debug,
impl<T> Debug for PatchSignals<T>where
T: Debug,
impl<T> Eq for PatchSignals<T>where
T: Eq,
Source§impl<T> EventDataRead for PatchSignals<T>where
T: EventDataRead,
impl<T> EventDataRead for PatchSignals<T>where
T: EventDataRead,
type Reader = PatchSignalsReader<<T as EventDataRead>::Reader>
fn line_reader() -> <PatchSignals<T> as EventDataRead>::Reader
Source§impl<T> EventDataWrite for PatchSignals<T>where
T: EventDataWrite,
impl<T> EventDataWrite for PatchSignals<T>where
T: EventDataWrite,
Source§impl<T> From<PatchSignals<T>> for EventData<T>
impl<T> From<PatchSignals<T>> for EventData<T>
Source§fn from(value: PatchSignals<T>) -> EventData<T>
fn from(value: PatchSignals<T>) -> EventData<T>
Converts to this type from the input type.
Source§impl<T> Hash for PatchSignals<T>where
T: Hash,
impl<T> Hash for PatchSignals<T>where
T: Hash,
Source§impl<T> PartialEq for PatchSignals<T>where
T: PartialEq,
impl<T> PartialEq for PatchSignals<T>where
T: PartialEq,
Source§fn eq(&self, other: &PatchSignals<T>) -> bool
fn eq(&self, other: &PatchSignals<T>) -> bool
Tests for
self and other values to be equal, and is used by ==.impl<T> StructuralPartialEq for PatchSignals<T>where
T: PartialEq,
Source§impl<T> TryFrom<PatchSignals<T>> for Event<PatchSignals<T>>
impl<T> TryFrom<PatchSignals<T>> for Event<PatchSignals<T>>
Source§type Error = EventBuildError
type Error = EventBuildError
The type returned in the event of a conversion error.
Source§fn try_from(
value: PatchSignals<T>,
) -> Result<Event<PatchSignals<T>>, <Event<PatchSignals<T>> as TryFrom<PatchSignals<T>>>::Error>
fn try_from( value: PatchSignals<T>, ) -> Result<Event<PatchSignals<T>>, <Event<PatchSignals<T>> as TryFrom<PatchSignals<T>>>::Error>
Performs the conversion.
Auto Trait Implementations§
impl<T> Freeze for PatchSignals<T>where
T: Freeze,
impl<T> RefUnwindSafe for PatchSignals<T>where
T: RefUnwindSafe,
impl<T> Send for PatchSignals<T>where
T: Send,
impl<T> Sync for PatchSignals<T>where
T: Sync,
impl<T> Unpin for PatchSignals<T>where
T: Unpin,
impl<T> UnsafeUnpin for PatchSignals<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for PatchSignals<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
Compare self to
key and return true if they are equal.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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