Struct PatchSignals
pub struct PatchSignals<T = String> {
pub signals: T,
pub only_if_missing: bool,
}
Expand description
PatchSignals
patches signals into the signal store
Fields§
§signals: T
signals
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: bool
Whether 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§
§impl<T> PatchSignals<T>
impl<T> PatchSignals<T>
pub const TYPE: EventType = EventType::PatchSignals
pub fn new(signals: T) -> PatchSignals<T>
pub fn new(signals: T) -> PatchSignals<T>
Create a new PatchSignals
data blob.
pub fn into_sse_event(self) -> Event<PatchSignals<T>>
pub fn into_sse_event(self) -> Event<PatchSignals<T>>
Consume self
as an Event
.
pub fn into_datastar_event(self) -> Event<EventData<T>>
pub fn into_datastar_event(self) -> Event<EventData<T>>
Consume self
as a super::DatastarEvent
.
pub 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.
pub 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§
§impl<T> Clone for PatchSignals<T>where
T: Clone,
impl<T> Clone for PatchSignals<T>where
T: Clone,
§fn clone(&self) -> PatchSignals<T>
fn clone(&self) -> PatchSignals<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl<T> Debug for PatchSignals<T>where
T: Debug,
impl<T> Debug for PatchSignals<T>where
T: Debug,
§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
§impl<T> EventDataWrite for PatchSignals<T>where
T: EventDataWrite,
impl<T> EventDataWrite for PatchSignals<T>where
T: EventDataWrite,
fn write_data(&self, w: &mut impl Write) -> Result<(), OpaqueError>
§impl<T> From<PatchSignals<T>> for Event<EventData<T>>
impl<T> From<PatchSignals<T>> for Event<EventData<T>>
§fn from(value: PatchSignals<T>) -> Event<EventData<T>>
fn from(value: PatchSignals<T>) -> Event<EventData<T>>
Converts to this type from the input type.
§impl<T> From<PatchSignals<T>> for Event<PatchSignals<T>>
impl<T> From<PatchSignals<T>> for Event<PatchSignals<T>>
§fn from(value: PatchSignals<T>) -> Event<PatchSignals<T>>
fn from(value: PatchSignals<T>) -> Event<PatchSignals<T>>
Converts to this type from the input type.
§impl<T> From<PatchSignals<T>> for EventData<T>
impl<T> From<PatchSignals<T>> for EventData<T>
§fn from(value: PatchSignals<T>) -> EventData<T>
fn from(value: PatchSignals<T>) -> EventData<T>
Converts to this type from the input type.
§impl<T> Hash for PatchSignals<T>where
T: Hash,
impl<T> Hash for PatchSignals<T>where
T: Hash,
§impl<T> PartialEq for PatchSignals<T>where
T: PartialEq,
impl<T> PartialEq for PatchSignals<T>where
T: PartialEq,
impl<T> Eq for PatchSignals<T>where
T: Eq,
impl<T> StructuralPartialEq for PatchSignals<T>
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> UnwindSafe for PatchSignals<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more
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
Compare self to
key
and return true
if they are equal.§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> ⓘ
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§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>
Create a new
Policy
that returns Action::Follow
only if self
and other
return
Action::Follow
. Read more