Struct ExecuteScript
pub struct ExecuteScript {
pub script: NonEmptyStr,
pub auto_remove: Option<bool>,
pub attributes: Option<Vec<ScriptAttribute>>,
}http and std only.Expand description
ExecuteScript executes JavaScript in the browser
See the Datastar documentation.
Fields§
§script: NonEmptyStrscript is a string that represents the JavaScript to be executed by the browser.
auto_remove: Option<bool>Whether to remove the script after execution.
If not provided the Datastar client side will default to true.
attributes: Option<Vec<ScriptAttribute>>A list of attributes to add to the script element.
If not provided the Datastar client side will default to type module.
Each item in the array must be a string in the format key value,
boolean value used in cased of boolean attributes.
Implementations§
§impl ExecuteScript
impl ExecuteScript
pub const TYPE: EventType = EventType::PatchElements
pub const fn new(script: NonEmptyStr) -> ExecuteScript
pub const fn new(script: NonEmptyStr) -> ExecuteScript
Create a new ExecuteScript data blob.
pub fn try_into_sse_event(self) -> Result<Event<ExecuteScript>, EventBuildError>
pub fn try_into_sse_event(self) -> Result<Event<ExecuteScript>, EventBuildError>
Consume self as an Event.
pub fn try_into_datastar_event<T>(
self,
) -> Result<Event<EventData<T>>, EventBuildError>
pub fn try_into_datastar_event<T>( self, ) -> Result<Event<EventData<T>>, EventBuildError>
Consume self as a super::DatastarEvent.
pub fn with_auto_remove(self, auto_remove: bool) -> ExecuteScript
pub fn with_auto_remove(self, auto_remove: bool) -> ExecuteScript
Set whether to remove the script after execution.
pub fn set_auto_remove(&mut self, auto_remove: bool) -> &mut ExecuteScript
pub fn set_auto_remove(&mut self, auto_remove: bool) -> &mut ExecuteScript
Set whether to remove the script after execution.
pub fn with_attribute(self, attribute: ScriptAttribute) -> ExecuteScript
pub fn with_attribute(self, attribute: ScriptAttribute) -> ExecuteScript
Set a single attribute to add to the script element.
This overwrites any previously added script attribute.
pub fn set_attribute(
&mut self,
attribute: ScriptAttribute,
) -> &mut ExecuteScript
pub fn set_attribute( &mut self, attribute: ScriptAttribute, ) -> &mut ExecuteScript
Set a single attribute to add to the script element.
This overwrites any previously added script attribute.
pub fn with_attributes(
self,
attributes: impl IntoIterator<Item = ScriptAttribute>,
) -> ExecuteScript
pub fn with_attributes( self, attributes: impl IntoIterator<Item = ScriptAttribute>, ) -> ExecuteScript
Set a list of attributes to add to the script element.
pub fn set_attributes(
&mut self,
attributes: impl IntoIterator<Item = ScriptAttribute>,
) -> &mut ExecuteScript
pub fn set_attributes( &mut self, attributes: impl IntoIterator<Item = ScriptAttribute>, ) -> &mut ExecuteScript
Set a list of attributes to add to the script element.
pub fn with_additional_attribute(
self,
attribute: ScriptAttribute,
) -> ExecuteScript
pub fn with_additional_attribute( self, attribute: ScriptAttribute, ) -> ExecuteScript
Add an additional attribute
pub fn set_additional_attribute(
&mut self,
attribute: ScriptAttribute,
) -> &mut ExecuteScript
pub fn set_additional_attribute( &mut self, attribute: ScriptAttribute, ) -> &mut ExecuteScript
Add an additional attribute
pub fn with_additional_attributes(
self,
attributes: impl IntoIterator<Item = ScriptAttribute>,
) -> ExecuteScript
pub fn with_additional_attributes( self, attributes: impl IntoIterator<Item = ScriptAttribute>, ) -> ExecuteScript
Set a list of attributes to add to the script element.
pub fn set_additional_attributes(
&mut self,
attributes: impl IntoIterator<Item = ScriptAttribute>,
) -> &mut ExecuteScript
pub fn set_additional_attributes( &mut self, attributes: impl IntoIterator<Item = ScriptAttribute>, ) -> &mut ExecuteScript
Set a list of attributes to add to the script element.
Trait Implementations§
§impl Clone for ExecuteScript
impl Clone for ExecuteScript
§fn clone(&self) -> ExecuteScript
fn clone(&self) -> ExecuteScript
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ExecuteScript
impl Debug for ExecuteScript
impl Eq for ExecuteScript
§impl EventDataWrite for ExecuteScript
impl EventDataWrite for ExecuteScript
fn write_data( &self, w: &mut impl Write, ) -> Result<(), Box<dyn Error + Send + Sync>>
§fn size_hint(&self) -> Option<usize>
fn size_hint(&self) -> Option<usize>
write_data will produce
(excluding any data: line prefixes inserted around it), used to
pre-reserve serialization buffers. None when unknown up front.§impl<T> From<ExecuteScript> for EventData<T>
impl<T> From<ExecuteScript> for EventData<T>
§fn from(value: ExecuteScript) -> EventData<T>
fn from(value: ExecuteScript) -> EventData<T>
§impl Hash for ExecuteScript
impl Hash for ExecuteScript
§impl PartialEq for ExecuteScript
impl PartialEq for ExecuteScript
impl StructuralPartialEq for ExecuteScript
§impl TryFrom<ExecuteScript> for Event<ExecuteScript>
impl TryFrom<ExecuteScript> for Event<ExecuteScript>
§type Error = EventBuildError
type Error = EventBuildError
§fn try_from(
value: ExecuteScript,
) -> Result<Event<ExecuteScript>, <Event<ExecuteScript> as TryFrom<ExecuteScript>>::Error>
fn try_from( value: ExecuteScript, ) -> Result<Event<ExecuteScript>, <Event<ExecuteScript> as TryFrom<ExecuteScript>>::Error>
§impl<T> TryFrom<ExecuteScript> for Event<EventData<T>>
impl<T> TryFrom<ExecuteScript> for Event<EventData<T>>
§type Error = EventBuildError
type Error = EventBuildError
Auto Trait Implementations§
impl Forget for ExecuteScript
impl Freeze for ExecuteScriptwhere
*const ThinInner is !null: Freeze,
*const u8 is !null: Freeze,
PhantomData<ScriptAttribute>: Freeze,
impl Move for ExecuteScript
impl RefUnwindSafe for ExecuteScript
impl Send for ExecuteScript
impl Sync for ExecuteScript
impl Unpin for ExecuteScript
impl UnsafeUnpin for ExecuteScriptwhere
*const ThinInner is !null: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<ScriptAttribute>: UnsafeUnpin,
impl UnwindSafe for ExecuteScriptwhere
NonNull<ThinInner>: UnwindSafe,
RawVecInner: UnwindSafe,
&'static str: UnwindSafe,
BoxRaw<str>: UnwindSafe,
Arc<str>: 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
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,
§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<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<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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§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