Skip to main content

MaybeSignal

Enum MaybeSignal 

Source
pub enum MaybeSignal<T, S = SyncStorage>
where T: 'static, S: Storage<T>,
{ Static(T), Dynamic(Signal<T, S>), }
๐Ÿ‘ŽDeprecated since 0.7.0-rc3: MaybeSignal<T> is deprecated in favour of Signal<T> which is Copy, now has a more efficient From<T> implementation and other benefits in 0.7.
Expand description

A wrapper for a value that is either T or Signal<T>.

This allows you to create APIs that take either a reactive or a non-reactive value of the same type. This is especially useful for component properties.

let (count, set_count) = signal(2);
let double_count = MaybeSignal::derive(move || count.get() * 2);
let memoized_double_count = Memo::new(move |_| count.get() * 2);
let static_value = 5;

// this function takes either a reactive or non-reactive value
fn above_3(arg: &MaybeSignal<i32>) -> bool {
    // โœ… calling the signal clones and returns the value
    //    it is a shorthand for arg.get()
    arg.get() > 3
}

assert_eq!(above_3(&static_value.into()), true);
assert_eq!(above_3(&count.into()), false);
assert_eq!(above_3(&double_count), true);
assert_eq!(above_3(&memoized_double_count.into()), true);

Variantsยง

ยง

Static(T)

๐Ÿ‘ŽDeprecated since 0.7.0-rc3: MaybeSignal<T> is deprecated in favour of Signal<T> which is Copy, now has a more efficient From<T> implementation and other benefits in 0.7.

An unchanging value of type T.

ยง

Dynamic(Signal<T, S>)

๐Ÿ‘ŽDeprecated since 0.7.0-rc3: MaybeSignal<T> is deprecated in favour of Signal<T> which is Copy, now has a more efficient From<T> implementation and other benefits in 0.7.

A reactive signal that contains a value of type T.

Implementationsยง

Sourceยง

impl<T> MaybeSignal<T>
where T: Send + Sync,

Source

pub fn derive( derived_signal: impl Fn() -> T + Send + Sync + 'static, ) -> MaybeSignal<T>

Wraps a derived signal, i.e., any computation that accesses one or more reactive signals.

Sourceยง

impl<T> MaybeSignal<T, LocalStorage>

Source

pub fn derive_local( derived_signal: impl Fn() -> T + 'static, ) -> MaybeSignal<T, LocalStorage>

Wraps a derived signal, i.e., any computation that accesses one or more reactive signals.

Trait Implementationsยง

Sourceยง

impl<V, S> AddAnyAttr for MaybeSignal<V, S>
where V: RenderHtml + Clone + Send + Sync + 'static, <V as Render>::State: 'static, MaybeSignal<V, S>: Get<Value = V>, S: Storage<V> + Storage<Option<V>> + Send + Sync + 'static,

Sourceยง

type Output<SomeNewAttr: Attribute> = MaybeSignal<V, S>

The new type once the attribute has been added.
Sourceยง

fn add_any_attr<NewAttr>( self, _attr: NewAttr, ) -> <MaybeSignal<V, S> as AddAnyAttr>::Output<NewAttr>
where NewAttr: Attribute,

Adds an attribute to the view.
Sourceยง

impl<V, S> AttributeValue for MaybeSignal<V, S>
where V: AttributeValue + Send + Sync + Clone + 'static, <V as AttributeValue>::State: 'static, MaybeSignal<V, S>: Get<Value = V>, S: Storage<V> + Storage<Option<V>> + Send + Sync + 'static,

Sourceยง

type AsyncOutput = MaybeSignal<V, S>

The type once all async data have loaded.
Sourceยง

type State = RenderEffect<<V as AttributeValue>::State>

The state that should be retained between building and rebuilding.
Sourceยง

type Cloneable = MaybeSignal<V, S>

A version of the value that can be cloned. This can be the same type, or a reference-counted type. Generally speaking, this does not need to refer to the same data, but should behave in the same way. So for example, making an event handler cloneable should probably make it reference-counted (so that a FnMut() continues mutating the same closure), but making a String cloneable does not necessarily need to make it an Arc<str>, as two different clones of a String will still have the same value.
Sourceยง

type CloneableOwned = MaybeSignal<V, S>

A cloneable type that is also 'static. This is used for spreading across types when the spreadable attribute needs to be owned. In some cases (&'a str to Arc<str>, etc.) the owned cloneable type has worse performance than the cloneable type, so they are separate.
Sourceยง

fn html_len(&self) -> usize

An approximation of the actual length of this attribute in HTML.
Sourceยง

fn to_html(self, key: &str, buf: &mut String)

Renders the attribute value to HTML.
Sourceยง

fn to_template(_key: &str, _buf: &mut String)

Renders the attribute value to HTML for a <template>.
Sourceยง

fn hydrate<const FROM_SERVER: bool>( self, key: &str, el: &Element, ) -> <MaybeSignal<V, S> as AttributeValue>::State

Adds interactivity as necessary, given DOM nodes that were created from HTML that has either been rendered on the server, or cloned for a <template>.
Sourceยง

fn build( self, el: &Element, key: &str, ) -> <MaybeSignal<V, S> as AttributeValue>::State

Adds this attribute to the element during client-side rendering.
Sourceยง

fn rebuild( self, key: &str, state: &mut <MaybeSignal<V, S> as AttributeValue>::State, )

Applies a new value for the attribute.
Sourceยง

fn into_cloneable(self) -> <MaybeSignal<V, S> as AttributeValue>::Cloneable

Converts this attribute into an equivalent that can be cloned.
Sourceยง

fn into_cloneable_owned( self, ) -> <MaybeSignal<V, S> as AttributeValue>::CloneableOwned

Converts this attributes into an equivalent that can be cloned and is 'static.
Sourceยง

fn dry_resolve(&mut self)

โ€œRunsโ€ the attribute without other side effects. For primitive types, this is a no-op. For reactive types, this can be used to gather data about reactivity or about asynchronous data that needs to be loaded.
Sourceยง

async fn resolve(self) -> <MaybeSignal<V, S> as AttributeValue>::AsyncOutput

โ€œResolvesโ€ this into a form that is not waiting for any asynchronous data.
Sourceยง

impl<T, S> Clone for MaybeSignal<T, S>
where T: Clone, S: Storage<T>,

Sourceยง

fn clone(&self) -> MaybeSignal<T, S>

Returns a duplicate of the value. Read more
1.0.0 ยท Sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Sourceยง

impl<T, S> Debug for MaybeSignal<T, S>
where T: Debug + 'static, S: Debug + Storage<T>,

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Sourceยง

impl<T, S> Default for MaybeSignal<T, S>
where T: Default, S: Storage<T>,

Sourceยง

fn default() -> MaybeSignal<T, S>

Returns the โ€œdefault valueโ€ for a type. Read more
Sourceยง

impl<T, S> DefinedAt for MaybeSignal<T, S>
where S: Storage<T>,

Sourceยง

fn defined_at(&self) -> Option<&'static Location<'static>>

Returns the location at which the signal was defined. This is usually simply None in release mode.
Sourceยง

impl<'de, T, St> Deserialize<'de> for MaybeSignal<T, St>
where T: Deserialize<'de>, St: Storage<T>,

Sourceยง

fn deserialize<D>( deserializer: D, ) -> Result<MaybeSignal<T, St>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Sourceยง

impl<S> From<&str> for MaybeSignal<String, S>

Sourceยง

fn from(value: &str) -> MaybeSignal<String, S>

Converts to this type from the input type.
Sourceยง

impl<T> From<ArcMemo<T>> for MaybeSignal<T>
where T: Send + Sync,

Sourceยง

fn from(value: ArcMemo<T>) -> MaybeSignal<T>

Converts to this type from the input type.
Sourceยง

impl<T> From<ArcReadSignal<T>> for MaybeSignal<T>
where T: Send + Sync,

Sourceยง

fn from(value: ArcReadSignal<T>) -> MaybeSignal<T>

Converts to this type from the input type.
Sourceยง

impl<T> From<ArcRwSignal<T>> for MaybeSignal<T>
where T: Send + Sync + 'static,

Sourceยง

fn from(value: ArcRwSignal<T>) -> MaybeSignal<T>

Converts to this type from the input type.
Sourceยง

impl<T> From<MaybeSignal<Option<T>>> for MaybeProp<T>
where T: Send + Sync, SyncStorage: Storage<Option<T>>,

Sourceยง

fn from(value: MaybeSignal<Option<T>>) -> MaybeProp<T>

Converts to this type from the input type.
Sourceยง

impl<T> From<MaybeSignal<Option<T>, LocalStorage>> for MaybeProp<T, LocalStorage>
where T: Send + Sync,

Sourceยง

fn from( value: MaybeSignal<Option<T>, LocalStorage>, ) -> MaybeProp<T, LocalStorage>

Converts to this type from the input type.
Sourceยง

impl<T> From<MaybeSignal<T>> for Signal<Option<T>>
where T: Clone + Send + Sync + 'static,

Sourceยง

fn from(value: MaybeSignal<T>) -> Signal<Option<T>>

Converts to this type from the input type.
Sourceยง

impl<T> From<MaybeSignal<T>> for Signal<T>
where T: Send + Sync + 'static,

Sourceยง

fn from(value: MaybeSignal<T>) -> Signal<T>

Converts to this type from the input type.
Sourceยง

impl<T> From<MaybeSignal<T, LocalStorage>> for Signal<Option<T>, LocalStorage>
where T: Clone + Send + Sync + 'static,

Sourceยง

fn from(value: MaybeSignal<T, LocalStorage>) -> Signal<Option<T>, LocalStorage>

Converts to this type from the input type.
Sourceยง

impl<T> From<MaybeSignal<T, LocalStorage>> for Signal<T, LocalStorage>
where T: Send + Sync + 'static,

Sourceยง

fn from(value: MaybeSignal<T, LocalStorage>) -> Signal<T, LocalStorage>

Converts to this type from the input type.
Sourceยง

impl<V, S> From<MaybeSignal<V, S>> for TextProp
where V: Into<Oco<'static, str>> + Clone + Send + Sync + 'static, MaybeSignal<V, S>: Get<Value = V>, S: Storage<V> + Storage<Option<V>> + Send + Sync + 'static,

Sourceยง

fn from(s: MaybeSignal<V, S>) -> TextProp

Converts to this type from the input type.
Sourceยง

impl<T> From<Memo<T>> for MaybeSignal<T>
where T: Send + Sync,

Sourceยง

fn from(value: Memo<T>) -> MaybeSignal<T>

Converts to this type from the input type.
Sourceยง

impl<T> From<Memo<T, LocalStorage>> for MaybeSignal<T, LocalStorage>

Sourceยง

fn from(value: Memo<T, LocalStorage>) -> MaybeSignal<T, LocalStorage>

Converts to this type from the input type.
Sourceยง

impl<T> From<ReadSignal<T>> for MaybeSignal<T>
where T: Send + Sync,

Sourceยง

fn from(value: ReadSignal<T>) -> MaybeSignal<T>

Converts to this type from the input type.
Sourceยง

impl<T> From<ReadSignal<T, LocalStorage>> for MaybeSignal<T, LocalStorage>

Sourceยง

fn from(value: ReadSignal<T, LocalStorage>) -> MaybeSignal<T, LocalStorage>

Converts to this type from the input type.
Sourceยง

impl<T> From<RwSignal<T>> for MaybeSignal<T>
where T: Send + Sync,

Sourceยง

fn from(value: RwSignal<T>) -> MaybeSignal<T>

Converts to this type from the input type.
Sourceยง

impl<T> From<RwSignal<T, LocalStorage>> for MaybeSignal<T, LocalStorage>

Sourceยง

fn from(value: RwSignal<T, LocalStorage>) -> MaybeSignal<T, LocalStorage>

Converts to this type from the input type.
Sourceยง

impl<T, S> From<Signal<T, S>> for MaybeSignal<T, S>
where S: Storage<T>,

Sourceยง

fn from(value: Signal<T, S>) -> MaybeSignal<T, S>

Converts to this type from the input type.
Sourceยง

impl<T> From<T> for MaybeSignal<T>
where SyncStorage: Storage<T>,

Sourceยง

fn from(value: T) -> MaybeSignal<T>

Converts to this type from the input type.
Sourceยง

impl<T> FromLocal<ArcMemo<T, LocalStorage>> for MaybeSignal<T, LocalStorage>

Sourceยง

fn from_local(value: ArcMemo<T, LocalStorage>) -> MaybeSignal<T, LocalStorage>

Converts between the types.
Sourceยง

impl<T> FromLocal<ArcReadSignal<T>> for MaybeSignal<T, LocalStorage>

Sourceยง

fn from_local(value: ArcReadSignal<T>) -> MaybeSignal<T, LocalStorage>

Converts between the types.
Sourceยง

impl<T> FromLocal<ArcRwSignal<T>> for MaybeSignal<T, LocalStorage>
where T: 'static,

Sourceยง

fn from_local(value: ArcRwSignal<T>) -> MaybeSignal<T, LocalStorage>

Converts between the types.
Sourceยง

impl<T> FromLocal<T> for MaybeSignal<T, LocalStorage>

Sourceยง

fn from_local(value: T) -> MaybeSignal<T, LocalStorage>

Converts between the types.
Sourceยง

impl<V, S> InnerHtmlValue for MaybeSignal<V, S>
where V: InnerHtmlValue + Clone + Send + Sync + 'static, <V as InnerHtmlValue>::State: 'static, MaybeSignal<V, S>: Get<Value = V>, S: Storage<V> + Storage<Option<V>> + Send + Sync + 'static,

Sourceยง

type AsyncOutput = MaybeSignal<V, S>

The type after all async data have resolved.
Sourceยง

type State = RenderEffect<<V as InnerHtmlValue>::State>

The view state retained between building and rebuilding.
Sourceยง

type Cloneable = MaybeSignal<V, S>

An equivalent value that can be cloned.
Sourceยง

type CloneableOwned = MaybeSignal<V, S>

An equivalent value that can be cloned and is 'static.
Sourceยง

fn html_len(&self) -> usize

The estimated length of the HTML.
Sourceยง

fn to_html(self, buf: &mut String)

Renders the class to HTML.
Sourceยง

fn to_template(_buf: &mut String)

Renders the class to HTML for a <template>.
Sourceยง

fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <MaybeSignal<V, S> as InnerHtmlValue>::State

Adds interactivity as necessary, given DOM nodes that were created from HTML that has either been rendered on the server, or cloned for a <template>.
Sourceยง

fn build(self, el: &Element) -> <MaybeSignal<V, S> as InnerHtmlValue>::State

Adds this class to the element during client-side rendering.
Sourceยง

fn rebuild(self, state: &mut <MaybeSignal<V, S> as InnerHtmlValue>::State)

Updates the value.
Sourceยง

fn into_cloneable(self) -> <MaybeSignal<V, S> as InnerHtmlValue>::Cloneable

Converts this to a cloneable type.
Sourceยง

fn into_cloneable_owned( self, ) -> <MaybeSignal<V, S> as InnerHtmlValue>::CloneableOwned

Converts this to a cloneable, owned type.
Sourceยง

fn dry_resolve(&mut self)

โ€œRunsโ€ the attribute without other side effects. For primitive types, this is a no-op. For reactive types, this can be used to gather data about reactivity or about asynchronous data that needs to be loaded.
Sourceยง

async fn resolve(self) -> <MaybeSignal<V, S> as InnerHtmlValue>::AsyncOutput

โ€œResolvesโ€ this into a type that is not waiting for any asynchronous data.
Sourceยง

impl<V, S> IntoClass for MaybeSignal<V, S>
where V: IntoClass + Clone + Send + Sync + 'static, <V as IntoClass>::State: 'static, MaybeSignal<V, S>: Get<Value = V>, S: Storage<V> + Storage<Option<V>> + Send + Sync + 'static,

Sourceยง

type AsyncOutput = MaybeSignal<V, S>

The type after all async data have resolved.
Sourceยง

type State = RenderEffect<<V as IntoClass>::State>

The view state retained between building and rebuilding.
Sourceยง

type Cloneable = MaybeSignal<V, S>

An equivalent value that can be cloned.
Sourceยง

type CloneableOwned = MaybeSignal<V, S>

An equivalent value that can be cloned and is 'static.
Sourceยง

fn html_len(&self) -> usize

The estimated length of the HTML.
Sourceยง

fn to_html(self, class: &mut String)

Renders the class to HTML.
Sourceยง

fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <MaybeSignal<V, S> as IntoClass>::State

Adds interactivity as necessary, given DOM nodes that were created from HTML that has either been rendered on the server, or cloned for a <template>.
Sourceยง

fn build(self, el: &Element) -> <MaybeSignal<V, S> as IntoClass>::State

Adds this class to the element during client-side rendering.
Sourceยง

fn rebuild(self, state: &mut <MaybeSignal<V, S> as IntoClass>::State)

Updates the value.
Sourceยง

fn into_cloneable(self) -> <MaybeSignal<V, S> as IntoClass>::Cloneable

Converts this to a cloneable type.
Sourceยง

fn into_cloneable_owned( self, ) -> <MaybeSignal<V, S> as IntoClass>::CloneableOwned

Converts this to a cloneable, owned type.
Sourceยง

fn dry_resolve(&mut self)

โ€œRunsโ€ the attribute without other side effects. For primitive types, this is a no-op. For reactive types, this can be used to gather data about reactivity or about asynchronous data that needs to be loaded.
Sourceยง

async fn resolve(self) -> <MaybeSignal<V, S> as IntoClass>::AsyncOutput

โ€œResolvesโ€ this into a type that is not waiting for any asynchronous data.
Sourceยง

fn reset(state: &mut <MaybeSignal<V, S> as IntoClass>::State)

Reset the class list to the state before this class was added.
Sourceยง

const TEMPLATE: &'static str = ""

The HTML that should be included in a <template>.
Sourceยง

const MIN_LENGTH: usize = _

The minimum length of the HTML.
Sourceยง

fn to_template(class: &mut String)

Renders the class to HTML for a <template>.
Sourceยง

impl<V, S> IntoProperty for MaybeSignal<V, S>
where V: IntoProperty + Clone + Send + Sync + 'static, <V as IntoProperty>::State: 'static, MaybeSignal<V, S>: Get<Value = V>, S: Storage<V> + Storage<Option<V>> + Send + Sync + 'static,

Sourceยง

type State = RenderEffect<<V as IntoProperty>::State>

The view state retained between building and rebuilding.
Sourceยง

type Cloneable = MaybeSignal<V, S>

An equivalent value that can be cloned.
Sourceยง

type CloneableOwned = MaybeSignal<V, S>

An equivalent value that can be cloned and is 'static.
Sourceยง

fn hydrate<const FROM_SERVER: bool>( self, el: &Element, key: &str, ) -> <MaybeSignal<V, S> as IntoProperty>::State

Adds the property on an element created from HTML.
Sourceยง

fn build( self, el: &Element, key: &str, ) -> <MaybeSignal<V, S> as IntoProperty>::State

Adds the property during client-side rendering.
Sourceยง

fn rebuild( self, state: &mut <MaybeSignal<V, S> as IntoProperty>::State, key: &str, )

Updates the property with a new value.
Sourceยง

fn into_cloneable(self) -> <MaybeSignal<V, S> as IntoProperty>::Cloneable

Converts this to a cloneable type.
Sourceยง

fn into_cloneable_owned( self, ) -> <MaybeSignal<V, S> as IntoProperty>::CloneableOwned

Converts this to a cloneable, owned type.
Sourceยง

impl<V, S> IntoStyle for MaybeSignal<V, S>
where V: IntoStyle + Clone + Send + Sync + 'static, <V as IntoStyle>::State: 'static, MaybeSignal<V, S>: Get<Value = V>, S: Storage<V> + Storage<Option<V>> + Send + Sync + 'static,

Sourceยง

type AsyncOutput = MaybeSignal<V, S>

The type after all async data have resolved.
Sourceยง

type State = RenderEffect<<V as IntoStyle>::State>

The view state retained between building and rebuilding.
Sourceยง

type Cloneable = MaybeSignal<V, S>

An equivalent value that can be cloned.
Sourceยง

type CloneableOwned = MaybeSignal<V, S>

An equivalent value that can be cloned and is 'static.
Sourceยง

fn to_html(self, style: &mut String)

Renders the style to HTML.
Sourceยง

fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <MaybeSignal<V, S> as IntoStyle>::State

Adds interactivity as necessary, given DOM nodes that were created from HTML that has either been rendered on the server, or cloned for a <template>.
Sourceยง

fn build(self, el: &Element) -> <MaybeSignal<V, S> as IntoStyle>::State

Adds this style to the element during client-side rendering.
Sourceยง

fn rebuild(self, state: &mut <MaybeSignal<V, S> as IntoStyle>::State)

Updates the value.
Sourceยง

fn into_cloneable(self) -> <MaybeSignal<V, S> as IntoStyle>::Cloneable

Converts this to a cloneable type.
Sourceยง

fn into_cloneable_owned( self, ) -> <MaybeSignal<V, S> as IntoStyle>::CloneableOwned

Converts this to a cloneable, owned type.
Sourceยง

fn dry_resolve(&mut self)

โ€œRunsโ€ the attribute without other side effects. For primitive types, this is a no-op. For reactive types, this can be used to gather data about reactivity or about asynchronous data that needs to be loaded.
Sourceยง

async fn resolve(self) -> <MaybeSignal<V, S> as IntoStyle>::AsyncOutput

โ€œResolvesโ€ this into a type that is not waiting for any asynchronous data.
Sourceยง

fn reset(state: &mut <MaybeSignal<V, S> as IntoStyle>::State)

Reset the styling to the state before this style was added.
Sourceยง

impl<V, S> IntoStyleValue for MaybeSignal<V, S>
where V: IntoStyleValue + Send + Sync + Clone + 'static, MaybeSignal<V, S>: Get<Value = V>, S: Storage<V> + Storage<Option<V>> + Send + Sync + 'static,

Sourceยง

type AsyncOutput = MaybeSignal<V, S>

The type after all async data have resolved.
Sourceยง

type State = (Arc<str>, RenderEffect<<V as IntoStyleValue>::State>)

The view state retained between building and rebuilding.
Sourceยง

type Cloneable = MaybeSignal<V, S>

An equivalent value that can be cloned.
Sourceยง

type CloneableOwned = MaybeSignal<V, S>

An equivalent value that can be cloned and is 'static.
Sourceยง

fn to_html(self, name: &str, style: &mut String)

Renders the style to HTML.
Sourceยง

fn build( self, style: &CssStyleDeclaration, name: &str, ) -> <MaybeSignal<V, S> as IntoStyleValue>::State

Adds this style to the element during client-side rendering.
Sourceยง

fn rebuild( self, style: &CssStyleDeclaration, name: &str, state: &mut <MaybeSignal<V, S> as IntoStyleValue>::State, )

Updates the value.
Sourceยง

fn hydrate( self, style: &CssStyleDeclaration, name: &str, ) -> <MaybeSignal<V, S> as IntoStyleValue>::State

Adds interactivity as necessary, given DOM nodes that were created from HTML that has either been rendered on the server, or cloned for a <template>.
Sourceยง

fn into_cloneable(self) -> <MaybeSignal<V, S> as IntoStyleValue>::Cloneable

Converts this to a cloneable type.
Sourceยง

fn into_cloneable_owned( self, ) -> <MaybeSignal<V, S> as IntoStyleValue>::CloneableOwned

Converts this to a cloneable, owned type.
Sourceยง

fn dry_resolve(&mut self)

โ€œRunsโ€ the attribute without other side effects. For primitive types, this is a no-op. For reactive types, this can be used to gather data about reactivity or about asynchronous data that needs to be loaded.
Sourceยง

async fn resolve(self) -> <MaybeSignal<V, S> as IntoStyleValue>::AsyncOutput

โ€œResolvesโ€ this into a type that is not waiting for any asynchronous data.
Sourceยง

impl<T, S> PartialEq for MaybeSignal<T, S>
where T: PartialEq + 'static, S: PartialEq + Storage<T>,

Sourceยง

fn eq(&self, other: &MaybeSignal<T, S>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 ยท Sourceยง

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Sourceยง

impl<T, S> ReadUntracked for MaybeSignal<T, S>
where T: Clone, S: Storage<SignalTypes<T, S>> + Storage<T>,

Sourceยง

type Value = ReadGuard<T, SignalReadGuard<T, S>>

The guard type that will be returned, which can be dereferenced to the value.
Sourceยง

fn try_read_untracked( &self, ) -> Option<<MaybeSignal<T, S> as ReadUntracked>::Value>

Returns the guard, or None if the signal has already been disposed.
Sourceยง

fn custom_try_read( &self, ) -> Option<Option<<MaybeSignal<T, S> as ReadUntracked>::Value>>

This is a backdoor to allow overriding the Read::try_read implementation despite it being auto implemented. Read more
Sourceยง

fn read_untracked(&self) -> Self::Value

Returns the guard. Read more
Sourceยง

impl<V, S> Render for MaybeSignal<V, S>
where V: Render + Clone + Send + Sync + 'static, <V as Render>::State: 'static, MaybeSignal<V, S>: Get<Value = V>, S: Storage<V> + Storage<Option<V>> + Send + Sync + 'static,

Sourceยง

type State = RenderEffectState<<V as Render>::State>

The โ€œview stateโ€ for this type, which can be retained between updates. Read more
Sourceยง

fn build(self) -> <MaybeSignal<V, S> as Render>::State

Creates the view for the first time, without hydrating from existing HTML.
Sourceยง

fn rebuild(self, state: &mut <MaybeSignal<V, S> as Render>::State)

Updates the view with new data.
Sourceยง

impl<V, S> RenderHtml for MaybeSignal<V, S>
where V: RenderHtml + Clone + Send + Sync + 'static, <V as Render>::State: 'static, MaybeSignal<V, S>: Get<Value = V>, S: Storage<V> + Storage<Option<V>> + Send + Sync + 'static,

Sourceยง

const MIN_LENGTH: usize = 0

The minimum length of HTML created when this view is rendered.
Sourceยง

type AsyncOutput = MaybeSignal<V, S>

The type of the view after waiting for all asynchronous data to load.
Sourceยง

type Owned = MaybeSignal<V, S>

An equivalent value that is 'static.
Sourceยง

fn dry_resolve(&mut self)

โ€œRunsโ€ the view without other side effects. For primitive types, this is a no-op. For reactive types, this can be used to gather data about reactivity or about asynchronous data that needs to be loaded.
Sourceยง

async fn resolve(self) -> <MaybeSignal<V, S> as RenderHtml>::AsyncOutput

Waits for any asynchronous sections of the view to load and returns the output.
Sourceยง

fn html_len(&self) -> usize

An estimated length for this view, when rendered to HTML. Read more
Sourceยง

fn to_html_with_buf( self, buf: &mut String, position: &mut Position, escape: bool, mark_branches: bool, extra_attrs: Vec<AnyAttribute>, )

Renders a view to HTML, writing it into the given buffer.
Sourceยง

fn to_html_async_with_buf<const OUT_OF_ORDER: bool>( self, buf: &mut StreamBuilder, position: &mut Position, escape: bool, mark_branches: bool, extra_attrs: Vec<AnyAttribute>, )
where MaybeSignal<V, S>: Sized,

Renders a view into a buffer of (synchronous or asynchronous) HTML chunks.
Sourceยง

fn hydrate<const FROM_SERVER: bool>( self, cursor: &Cursor, position: &PositionState, ) -> <MaybeSignal<V, S> as Render>::State

Makes a set of DOM nodes rendered from HTML interactive. Read more
Sourceยง

fn into_owned(self) -> <MaybeSignal<V, S> as RenderHtml>::Owned

Convert into the equivalent value that is 'static.
Sourceยง

const EXISTS: bool = true

Whether this should actually exist in the DOM, if it is the child of an element.
Sourceยง

fn to_html(self) -> String
where Self: Sized,

Renders a view to an HTML string.
Sourceยง

fn to_html_branching(self) -> String
where Self: Sized,

Renders a view to HTML with branch markers. This can be used to support libraries that diff HTML pages against one another, by marking sections of the view that branch to different types with marker comments.
Sourceยง

fn to_html_stream_in_order(self) -> StreamBuilder
where Self: Sized,

Renders a view to an in-order stream of HTML.
Sourceยง

fn to_html_stream_in_order_branching(self) -> StreamBuilder
where Self: Sized,

Renders a view to an in-order stream of HTML with branch markers. This can be used to support libraries that diff HTML pages against one another, by marking sections of the view that branch to different types with marker comments.
Sourceยง

fn to_html_stream_out_of_order(self) -> StreamBuilder
where Self: Sized,

Renders a view to an out-of-order stream of HTML.
Sourceยง

fn to_html_stream_out_of_order_branching(self) -> StreamBuilder
where Self: Sized,

Renders a view to an out-of-order stream of HTML with branch markers. This can be used to support libraries that diff HTML pages against one another, by marking sections of the view that branch to different types with marker comments.
Sourceยง

fn hydrate_async( self, cursor: &Cursor, position: &PositionState, ) -> impl Future<Output = Self::State>

Asynchronously makes a set of DOM nodes rendered from HTML interactive. Read more
Sourceยง

fn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::State
where Self: Sized,

Hydrates using RenderHtml::hydrate, beginning at the given element.
Sourceยง

fn hydrate_from_position<const FROM_SERVER: bool>( self, el: &Element, position: Position, ) -> Self::State
where Self: Sized,

Hydrates using RenderHtml::hydrate, beginning at the given element and position.
Sourceยง

impl<T, St> Serialize for MaybeSignal<T, St>
where T: Clone + Send + Sync + Serialize, St: Storage<SignalTypes<T, St>> + Storage<T>,

Sourceยง

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Sourceยง

impl<T, S> Track for MaybeSignal<T, S>
where S: Storage<T> + Storage<SignalTypes<T, S>>,

Sourceยง

fn track(&self)

Subscribes to this signal in the current reactive scope without doing anything with its value.
Sourceยง

impl<T, S> Copy for MaybeSignal<T, S>
where T: Copy, S: Storage<T>,

Sourceยง

impl<T, S> Eq for MaybeSignal<T, S>
where T: Eq + 'static, S: Eq + Storage<T>,

Sourceยง

impl<T, S> StructuralPartialEq for MaybeSignal<T, S>
where T: 'static, S: Storage<T>,

Auto Trait Implementationsยง

ยง

impl<T, S> Freeze for MaybeSignal<T, S>
where T: Freeze,

ยง

impl<T, S> RefUnwindSafe for MaybeSignal<T, S>
where T: RefUnwindSafe,

ยง

impl<T, S> Send for MaybeSignal<T, S>
where T: Send,

ยง

impl<T, S> Sync for MaybeSignal<T, S>
where T: Sync,

ยง

impl<T, S> Unpin for MaybeSignal<T, S>
where T: Unpin,

ยง

impl<T, S> UnwindSafe for MaybeSignal<T, S>
where T: UnwindSafe,

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<V, Key, Sig, T> BindAttribute<Key, Sig, T> for V
where V: AddAnyAttr, Key: AttributeKey, Sig: IntoSplitSignal<Value = T>, T: FromEventTarget + AttributeValue + PartialEq + Sync + 'static, Signal<BoolOrT<T>>: IntoProperty, <Sig as IntoSplitSignal>::Read: Get<Value = T> + Send + Sync + Clone + 'static, <Sig as IntoSplitSignal>::Write: Send + Clone + 'static, Element: GetValue<T>,

Sourceยง

type Output = <V as AddAnyAttr>::Output<Bind<Key, T, <Sig as IntoSplitSignal>::Read, <Sig as IntoSplitSignal>::Write>>

The type of the element with the two-way binding added.
Sourceยง

fn bind( self, key: Key, signal: Sig, ) -> <V as BindAttribute<Key, Sig, T>>::Output

Adds a two-way binding to the element, which adds an attribute and an event listener to the element when the element is created or hydrated. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Sourceยง

impl<T, K, V> CustomAttribute<K, V> for T

Sourceยง

fn attr(self, key: K, value: V) -> Self::Output<CustomAttr<K, V>>

Adds an HTML attribute by key and value.
Sourceยง

impl<V, T, P, D> DirectiveAttribute<T, P, D> for V
where V: AddAnyAttr, D: IntoDirective<T, P>, P: Clone + 'static, T: 'static,

Sourceยง

type Output = <V as AddAnyAttr>::Output<Directive<T, D, P>>

The type of the element with the directive added.
Sourceยง

fn directive( self, handler: D, param: P, ) -> <V as DirectiveAttribute<T, P, D>>::Output

Adds a directive to the element, which runs some custom logic in the browser when the element is created or hydrated.
Sourceยง

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Sourceยง

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Sourceยง

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Sourceยง

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Sourceยง

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Sourceยง

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Sourceยง

impl<T> From<!> for T

Sourceยง

fn from(t: !) -> T

Converts to this type from the input type.
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T> FromFormData for T

Sourceยง

fn from_event(ev: &Event) -> Result<T, FromFormDataError>

Tries to deserialize the data, given only the submit event.
Sourceยง

fn from_form_data(form_data: &FormData) -> Result<T, Error>

Tries to deserialize the data, given the actual form data.
Sourceยง

impl<E, T, Request> FromReq<DeleteUrl, Request, E> for T
where Request: Req<E> + Send + 'static, T: DeserializeOwned, E: FromServerFnError,

Sourceยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
Sourceยง

impl<E, T, Request> FromReq<GetUrl, Request, E> for T
where Request: Req<E> + Send + 'static, T: DeserializeOwned, E: FromServerFnError,

Sourceยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
Sourceยง

impl<E, T, Request, Encoding> FromReq<Patch<Encoding>, Request, E> for T
where Request: Req<E> + Send + 'static, Encoding: Decodes<T>, E: FromServerFnError,

Sourceยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
Sourceยง

impl<E, T, Request> FromReq<PatchUrl, Request, E> for T
where Request: Req<E> + Send + 'static, T: DeserializeOwned, E: FromServerFnError,

Sourceยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
Sourceยง

impl<E, T, Request, Encoding> FromReq<Post<Encoding>, Request, E> for T
where Request: Req<E> + Send + 'static, Encoding: Decodes<T>, E: FromServerFnError,

Sourceยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
Sourceยง

impl<E, T, Request> FromReq<PostUrl, Request, E> for T
where Request: Req<E> + Send + 'static, T: DeserializeOwned, E: FromServerFnError,

Sourceยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
Sourceยง

impl<E, T, Request, Encoding> FromReq<Put<Encoding>, Request, E> for T
where Request: Req<E> + Send + 'static, Encoding: Decodes<T>, E: FromServerFnError,

Sourceยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
Sourceยง

impl<E, T, Request> FromReq<PutUrl, Request, E> for T
where Request: Req<E> + Send + 'static, T: DeserializeOwned, E: FromServerFnError,

Sourceยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
Sourceยง

impl<E, Encoding, Response, T> FromRes<Patch<Encoding>, Response, E> for T
where Response: ClientRes<E> + Send, Encoding: Decodes<T>, E: FromServerFnError,

Sourceยง

async fn from_res(res: Response) -> Result<T, E>

Attempts to deserialize the outputs from a response.
Sourceยง

impl<E, Encoding, Response, T> FromRes<Post<Encoding>, Response, E> for T
where Response: ClientRes<E> + Send, Encoding: Decodes<T>, E: FromServerFnError,

Sourceยง

async fn from_res(res: Response) -> Result<T, E>

Attempts to deserialize the outputs from a response.
Sourceยง

impl<E, Encoding, Response, T> FromRes<Put<Encoding>, Response, E> for T
where Response: ClientRes<E> + Send, Encoding: Decodes<T>, E: FromServerFnError,

Sourceยง

async fn from_res(res: Response) -> Result<T, E>

Attempts to deserialize the outputs from a response.
Sourceยง

impl<S, T> FromStream<T> for S
where S: From<ArcReadSignal<Option<T>>> + Send + Sync, T: Send + Sync + 'static,

Sourceยง

fn from_stream(stream: impl Stream<Item = T> + Send + 'static) -> S

Creates a signal that contains the latest value of the stream.
Sourceยง

fn from_stream_unsync(stream: impl Stream<Item = T> + 'static) -> S

Creates a signal that contains the latest value of the stream.
Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T> IntoAny for T
where T: Send + RenderHtml,

Sourceยง

fn into_any(self) -> AnyView

Converts the view into a type-erased AnyView.
Sourceยง

impl<T> IntoAttributeValue for T
where T: AttributeValue,

Sourceยง

type Output = T

The attribute value into which this type can be converted.
Sourceยง

fn into_attribute_value(self) -> <T as IntoAttributeValue>::Output

Consumes this value, transforming it into an attribute value.
Sourceยง

impl<T> IntoEither for T

Sourceยง

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 more
Sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Sourceยง

impl<T> IntoMaybeErased for T
where T: RenderHtml,

Sourceยง

type Output = T

The type of the output.
Sourceยง

fn into_maybe_erased(self) -> <T as IntoMaybeErased>::Output

Converts the view into a type-erased view if in erased mode.
Sourceยง

impl<T, S> IntoOptionGetter<T, SignalMarker> for S
where S: Get<Value = Option<T>> + Clone + Send + Sync + 'static,

Sourceยง

fn into_option_getter(self) -> OptionGetter<T>

Converts the given value into an OptionGetter.
Sourceยง

impl<T> IntoRender for T
where T: Render,

Sourceยง

type Output = T

The renderable type into which this type can be converted.
Sourceยง

fn into_render(self) -> <T as IntoRender>::Output

Consumes this value, transforming it into the renderable type.
Sourceยง

impl<E, T, Request> IntoReq<DeleteUrl, Request, E> for T
where Request: ClientReq<E>, T: Serialize + Send, E: FromServerFnError,

Sourceยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
Sourceยง

impl<E, T, Request> IntoReq<GetUrl, Request, E> for T
where Request: ClientReq<E>, T: Serialize + Send, E: FromServerFnError,

Sourceยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
Sourceยง

impl<E, T, Encoding, Request> IntoReq<Patch<Encoding>, Request, E> for T
where Request: ClientReq<E>, Encoding: Encodes<T>, E: FromServerFnError,

Sourceยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
Sourceยง

impl<E, T, Request> IntoReq<PatchUrl, Request, E> for T
where Request: ClientReq<E>, T: Serialize + Send, E: FromServerFnError,

Sourceยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
Sourceยง

impl<E, T, Encoding, Request> IntoReq<Post<Encoding>, Request, E> for T
where Request: ClientReq<E>, Encoding: Encodes<T>, E: FromServerFnError,

Sourceยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
Sourceยง

impl<E, T, Request> IntoReq<PostUrl, Request, E> for T
where Request: ClientReq<E>, T: Serialize + Send, E: FromServerFnError,

Sourceยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
Sourceยง

impl<E, T, Encoding, Request> IntoReq<Put<Encoding>, Request, E> for T
where Request: ClientReq<E>, Encoding: Encodes<T>, E: FromServerFnError,

Sourceยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
Sourceยง

impl<E, T, Request> IntoReq<PutUrl, Request, E> for T
where Request: ClientReq<E>, T: Serialize + Send, E: FromServerFnError,

Sourceยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
Sourceยง

impl<E, Response, Encoding, T> IntoRes<Patch<Encoding>, Response, E> for T
where Response: TryRes<E>, Encoding: Encodes<T>, E: FromServerFnError + Send, T: Send,

Sourceยง

async fn into_res(self) -> Result<Response, E>

Attempts to serialize the output into an HTTP response.
Sourceยง

impl<E, Response, Encoding, T> IntoRes<Post<Encoding>, Response, E> for T
where Response: TryRes<E>, Encoding: Encodes<T>, E: FromServerFnError + Send, T: Send,

Sourceยง

async fn into_res(self) -> Result<Response, E>

Attempts to serialize the output into an HTTP response.
Sourceยง

impl<E, Response, Encoding, T> IntoRes<Put<Encoding>, Response, E> for T
where Response: TryRes<E>, Encoding: Encodes<T>, E: FromServerFnError + Send, T: Send,

Sourceยง

async fn into_res(self) -> Result<Response, E>

Attempts to serialize the output into an HTTP response.
Sourceยง

impl<T> IntoView for T
where T: Render + RenderHtml + Send,

Sourceยง

fn into_view(self) -> View<T>

Wraps the inner type.
Sourceยง

impl<T> Read for T
where T: Track + ReadUntracked,

Sourceยง

type Value = <T as ReadUntracked>::Value

The guard type that will be returned, which can be dereferenced to the value.
Sourceยง

fn try_read(&self) -> Option<<T as Read>::Value>

Subscribes to the signal, and returns the guard, or None if the signal has already been disposed.
Sourceยง

fn read(&self) -> Self::Value

Subscribes to the signal, and returns the guard. Read more
Sourceยง

impl<T> SerializableKey for T

Sourceยง

fn ser_key(&self) -> String

Serializes the key to a unique string. Read more
Sourceยง

impl<T> StorageAccess<T> for T

Sourceยง

fn as_borrowed(&self) -> &T

Borrows the value.
Sourceยง

fn into_taken(self) -> T

Takes the value.
Sourceยง

impl<T> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Sourceยง

impl<T> With for T
where T: Read,

Sourceยง

type Value = <<T as Read>::Value as Deref>::Target

The type of the value contained in the signal.
Sourceยง

fn try_with<U>(&self, fun: impl FnOnce(&<T as With>::Value) -> U) -> Option<U>

Subscribes to the signal, applies the closure to the value, and returns the result, or None if the signal has already been disposed.
Sourceยง

fn with<U>(&self, fun: impl FnOnce(&Self::Value) -> U) -> U

Subscribes to the signal, applies the closure to the value, and returns the result. Read more
Sourceยง

impl<T> WithUntracked for T

Sourceยง

type Value = <<T as ReadUntracked>::Value as Deref>::Target

The type of the value contained in the signal.
Sourceยง

fn try_with_untracked<U>( &self, fun: impl FnOnce(&<T as WithUntracked>::Value) -> U, ) -> Option<U>

Applies the closure to the value, and returns the result, or None if the signal has already been disposed.
Sourceยง

fn with_untracked<U>(&self, fun: impl FnOnce(&Self::Value) -> U) -> U

Applies the closure to the value, and returns the result. Read more
Sourceยง

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,