Struct Resource
pub struct Resource<T, Ser = JsonSerdeCodec>{
ser: PhantomData<Ser>,
data: AsyncDerived<T>,
refetch: RwSignal<usize>,
}
Expand description
An asynchronous resource.
Resources allow asynchronously loading data and serializing it from the server to the client, so that it loads on the server, and is then deserialized on the client. This improves performance by beginning data loading on the server when the request is made, rather than beginning it on the client after WASM has been loaded.
You can access the value of the resource either synchronously using .get()
or asynchronously
using .await
.
Fieldsยง
ยงser: PhantomData<Ser>
ยงdata: AsyncDerived<T>
ยงrefetch: RwSignal<usize>
Implementationsยง
ยงimpl<T> Resource<T, FromToStringCodec>where
FromToStringCodec: Encoder<T> + Decoder<T>,
<FromToStringCodec as Encoder<T>>::Error: Debug,
<FromToStringCodec as Decoder<T>>::Error: Debug,
<<FromToStringCodec as Decoder<T>>::Encoded as FromEncodedStr>::DecodingError: Debug,
<FromToStringCodec as Encoder<T>>::Encoded: IntoEncodedString,
<FromToStringCodec as Decoder<T>>::Encoded: FromEncodedStr,
T: Send + Sync,
impl<T> Resource<T, FromToStringCodec>where
FromToStringCodec: Encoder<T> + Decoder<T>,
<FromToStringCodec as Encoder<T>>::Error: Debug,
<FromToStringCodec as Decoder<T>>::Error: Debug,
<<FromToStringCodec as Decoder<T>>::Encoded as FromEncodedStr>::DecodingError: Debug,
<FromToStringCodec as Encoder<T>>::Encoded: IntoEncodedString,
<FromToStringCodec as Decoder<T>>::Encoded: FromEncodedStr,
T: Send + Sync,
pub fn new_str<S, Fut>(
source: impl Fn() -> S + Send + Sync + 'static,
fetcher: impl Fn(S) -> Fut + Send + Sync + 'static,
) -> Resource<T, FromToStringCodec>
pub fn new_str<S, Fut>( source: impl Fn() -> S + Send + Sync + 'static, fetcher: impl Fn(S) -> Fut + Send + Sync + 'static, ) -> Resource<T, FromToStringCodec>
Creates a new resource with the encoding FromToStringCodec
.
This takes a source
function and a fetcher
. The resource memoizes and reactively tracks
the value returned by source
. Whenever that value changes, it will run the fetcher
to
generate a new Future
to load data.
On creation, if you are on the server, this will run the fetcher
once to generate
a Future
whose value will be serialized from the server to the client. If you are on
the client, the initial value will be deserialized without re-running that async task.
pub fn new_str_blocking<S, Fut>(
source: impl Fn() -> S + Send + Sync + 'static,
fetcher: impl Fn(S) -> Fut + Send + Sync + 'static,
) -> Resource<T, FromToStringCodec>
pub fn new_str_blocking<S, Fut>( source: impl Fn() -> S + Send + Sync + 'static, fetcher: impl Fn(S) -> Fut + Send + Sync + 'static, ) -> Resource<T, FromToStringCodec>
Creates a new blocking resource with the encoding FromToStringCodec
.
This takes a source
function and a fetcher
. The resource memoizes and reactively tracks
the value returned by source
. Whenever that value changes, it will run the fetcher
to
generate a new Future
to load data.
On creation, if you are on the server, this will run the fetcher
once to generate
a Future
whose value will be serialized from the server to the client. If you are on
the client, the initial value will be deserialized without re-running that async task.
Blocking resources prevent any of the HTTP response from being sent until they have loaded. This is useful if you need their data to set HTML document metadata or information that needs to appear in HTTP headers.
ยงimpl<T> Resource<T>where
JsonSerdeCodec: Encoder<T> + Decoder<T>,
<JsonSerdeCodec as Encoder<T>>::Error: Debug,
<JsonSerdeCodec as Decoder<T>>::Error: Debug,
<<JsonSerdeCodec as Decoder<T>>::Encoded as FromEncodedStr>::DecodingError: Debug,
<JsonSerdeCodec as Encoder<T>>::Encoded: IntoEncodedString,
<JsonSerdeCodec as Decoder<T>>::Encoded: FromEncodedStr,
T: Send + Sync,
impl<T> Resource<T>where
JsonSerdeCodec: Encoder<T> + Decoder<T>,
<JsonSerdeCodec as Encoder<T>>::Error: Debug,
<JsonSerdeCodec as Decoder<T>>::Error: Debug,
<<JsonSerdeCodec as Decoder<T>>::Encoded as FromEncodedStr>::DecodingError: Debug,
<JsonSerdeCodec as Encoder<T>>::Encoded: IntoEncodedString,
<JsonSerdeCodec as Decoder<T>>::Encoded: FromEncodedStr,
T: Send + Sync,
pub fn new<S, Fut>(
source: impl Fn() -> S + Send + Sync + 'static,
fetcher: impl Fn(S) -> Fut + Send + Sync + 'static,
) -> Resource<T>
pub fn new<S, Fut>( source: impl Fn() -> S + Send + Sync + 'static, fetcher: impl Fn(S) -> Fut + Send + Sync + 'static, ) -> Resource<T>
Creates a new resource with the encoding JsonSerdeCodec
.
This takes a source
function and a fetcher
. The resource memoizes and reactively tracks
the value returned by source
. Whenever that value changes, it will run the fetcher
to
generate a new Future
to load data.
On creation, if you are on the server, this will run the fetcher
once to generate
a Future
whose value will be serialized from the server to the client. If you are on
the client, the initial value will be deserialized without re-running that async task.
pub fn new_blocking<S, Fut>(
source: impl Fn() -> S + Send + Sync + 'static,
fetcher: impl Fn(S) -> Fut + Send + Sync + 'static,
) -> Resource<T>
pub fn new_blocking<S, Fut>( source: impl Fn() -> S + Send + Sync + 'static, fetcher: impl Fn(S) -> Fut + Send + Sync + 'static, ) -> Resource<T>
Creates a new blocking resource with the encoding JsonSerdeCodec
.
This takes a source
function and a fetcher
. The resource memoizes and reactively tracks
the value returned by source
. Whenever that value changes, it will run the fetcher
to
generate a new Future
to load data.
On creation, if you are on the server, this will run the fetcher
once to generate
a Future
whose value will be serialized from the server to the client. If you are on
the client, the initial value will be deserialized without re-running that async task.
Blocking resources prevent any of the HTTP response from being sent until they have loaded. This is useful if you need their data to set HTML document metadata or information that needs to appear in HTTP headers.
ยงimpl<T, Ser> Resource<T, Ser>
impl<T, Ser> Resource<T, Ser>
pub fn new_with_options<S, Fut>(
source: impl Fn() -> S + Send + Sync + 'static,
fetcher: impl Fn(S) -> Fut + Send + Sync + 'static,
blocking: bool,
) -> Resource<T, Ser>
pub fn new_with_options<S, Fut>( source: impl Fn() -> S + Send + Sync + 'static, fetcher: impl Fn(S) -> Fut + Send + Sync + 'static, blocking: bool, ) -> Resource<T, Ser>
Creates a new resource with the encoding Ser
.
This takes a source
function and a fetcher
. The resource memoizes and reactively tracks
the value returned by source
. Whenever that value changes, it will run the fetcher
to
generate a new Future
to load data.
On creation, if you are on the server, this will run the fetcher
once to generate
a Future
whose value will be serialized from the server to the client. If you are on
the client, the initial value will be deserialized without re-running that async task.
If blocking
is true
, this is a blocking resource.
Blocking resources prevent any of the HTTP response from being sent until they have loaded. This is useful if you need their data to set HTML document metadata or information that needs to appear in HTTP headers.
pub fn map<U>(&self, f: impl FnOnce(&T) -> U) -> Option<U>
pub fn map<U>(&self, f: impl FnOnce(&T) -> U) -> Option<U>
Synchronously, reactively reads the current value of the resource and applies the function
f
to its value if it is Some(_)
.
pub fn refetch(&self)
pub fn refetch(&self)
Re-runs the async function with the current source data.
ยงimpl<T, E, Ser> Resource<Result<T, E>, Ser>where
Ser: Encoder<Result<T, E>> + Decoder<Result<T, E>>,
<Ser as Encoder<Result<T, E>>>::Error: Debug,
<Ser as Decoder<Result<T, E>>>::Error: Debug,
<<Ser as Decoder<Result<T, E>>>::Encoded as FromEncodedStr>::DecodingError: Debug,
<Ser as Encoder<Result<T, E>>>::Encoded: IntoEncodedString,
<Ser as Decoder<Result<T, E>>>::Encoded: FromEncodedStr,
T: Send + Sync,
E: Send + Sync + Clone,
impl<T, E, Ser> Resource<Result<T, E>, Ser>where
Ser: Encoder<Result<T, E>> + Decoder<Result<T, E>>,
<Ser as Encoder<Result<T, E>>>::Error: Debug,
<Ser as Decoder<Result<T, E>>>::Error: Debug,
<<Ser as Decoder<Result<T, E>>>::Encoded as FromEncodedStr>::DecodingError: Debug,
<Ser as Encoder<Result<T, E>>>::Encoded: IntoEncodedString,
<Ser as Decoder<Result<T, E>>>::Encoded: FromEncodedStr,
T: Send + Sync,
E: Send + Sync + Clone,
pub fn and_then<U>(&self, f: impl FnOnce(&T) -> U) -> Option<Result<U, E>>
pub fn and_then<U>(&self, f: impl FnOnce(&T) -> U) -> Option<Result<U, E>>
Applies the given function when a resource that returns Result<T, E>
has resolved and loaded an Ok(_)
, rather than requiring nested .map()
calls over the Option<Result<_, _>>
returned by the resource.
This is useful when used with features like server functions, in conjunction
with <ErrorBoundary/>
and <Suspense/>
, when these other components are
left to handle the None
and Err(_)
states.
Methods from Deref<Target = AsyncDerived<T>>ยง
pub fn ready(&self) -> AsyncDerivedReadyFuture โ
pub fn ready(&self) -> AsyncDerivedReadyFuture โ
Returns a Future
that is ready when this resource has next finished loading.
pub fn by_ref(&self) -> AsyncDerivedRefFuture<T> โ
pub fn by_ref(&self) -> AsyncDerivedRefFuture<T> โ
Returns a Future
that resolves when the computation is finished, and accesses the inner
value by reference rather than by cloning it.
Trait Implementationsยง
ยงimpl<T, Ser> AddAnyAttr for Resource<T, Ser>
impl<T, Ser> AddAnyAttr for Resource<T, Ser>
ยงtype Output<SomeNewAttr: Attribute> = Box<dyn FnMut() -> Suspend<<T as AddAnyAttr>::Output<<<SomeNewAttr as Attribute>::CloneableOwned as Attribute>::CloneableOwned>> + Send>
type Output<SomeNewAttr: Attribute> = Box<dyn FnMut() -> Suspend<<T as AddAnyAttr>::Output<<<SomeNewAttr as Attribute>::CloneableOwned as Attribute>::CloneableOwned>> + Send>
ยงfn add_any_attr<NewAttr>(
self,
attr: NewAttr,
) -> <Resource<T, Ser> as AddAnyAttr>::Output<NewAttr>
fn add_any_attr<NewAttr>( self, attr: NewAttr, ) -> <Resource<T, Ser> as AddAnyAttr>::Output<NewAttr>
ยงimpl<T, Ser> DefinedAt for Resource<T, Ser>
impl<T, Ser> DefinedAt for Resource<T, Ser>
ยงfn defined_at(&self) -> Option<&'static Location<'static>>
fn defined_at(&self) -> Option<&'static Location<'static>>
None
in
release mode.ยงimpl<T, Ser> From<ArcResource<T, Ser>> for Resource<T, Ser>
impl<T, Ser> From<ArcResource<T, Ser>> for Resource<T, Ser>
ยงfn from(arc_resource: ArcResource<T, Ser>) -> Resource<T, Ser>
fn from(arc_resource: ArcResource<T, Ser>) -> Resource<T, Ser>
ยงimpl<T, Ser> From<Resource<T, Ser>> for ArcResource<T, Ser>
impl<T, Ser> From<Resource<T, Ser>> for ArcResource<T, Ser>
ยงfn from(resource: Resource<T, Ser>) -> ArcResource<T, Ser>
fn from(resource: Resource<T, Ser>) -> ArcResource<T, Ser>
ยงimpl<T, Ser> IntoFuture for Resource<T, Ser>
impl<T, Ser> IntoFuture for Resource<T, Ser>
ยงtype IntoFuture = AsyncDerivedFuture<T>
type IntoFuture = AsyncDerivedFuture<T>
ยงfn into_future(self) -> <Resource<T, Ser> as IntoFuture>::IntoFuture
fn into_future(self) -> <Resource<T, Ser> as IntoFuture>::IntoFuture
ยงimpl<T, Ser> ReadUntracked for Resource<T, Ser>
impl<T, Ser> ReadUntracked for Resource<T, Ser>
ยงtype Value = <AsyncDerived<T> as ReadUntracked>::Value
type Value = <AsyncDerived<T> as ReadUntracked>::Value
ยงfn try_read_untracked(
&self,
) -> Option<<Resource<T, Ser> as ReadUntracked>::Value>
fn try_read_untracked( &self, ) -> Option<<Resource<T, Ser> as ReadUntracked>::Value>
None
if the signal has already been disposed.ยงfn read_untracked(&self) -> Self::Value
fn read_untracked(&self) -> Self::Value
ยงfn custom_try_read(&self) -> Option<Option<Self::Value>>
fn custom_try_read(&self) -> Option<Option<Self::Value>>
Read::try_read
implementation despite it being auto implemented. Read moreยงimpl<T, Ser> Render for Resource<T, Ser>
impl<T, Ser> Render for Resource<T, Ser>
ยงimpl<T, Ser> RenderHtml for Resource<T, Ser>
impl<T, Ser> RenderHtml for Resource<T, Ser>
ยงconst MIN_LENGTH: usize = 0usize
const MIN_LENGTH: usize = 0usize
ยงtype AsyncOutput = Option<T>
type AsyncOutput = Option<T>
ยงfn dry_resolve(&mut self)
fn dry_resolve(&mut self)
ยงfn resolve(
self,
) -> impl Future<Output = <Resource<T, Ser> as RenderHtml>::AsyncOutput> + Send
fn resolve( self, ) -> impl Future<Output = <Resource<T, Ser> as RenderHtml>::AsyncOutput> + Send
ยงfn to_html_with_buf(
self,
buf: &mut String,
position: &mut Position,
escape: bool,
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
)
fn to_html_with_buf( self, buf: &mut String, position: &mut Position, escape: bool, mark_branches: bool, extra_attrs: Vec<AnyAttribute>, )
ยง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>,
)
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>, )
ยงfn hydrate<const FROM_SERVER: bool>(
self,
cursor: &Cursor,
position: &PositionState,
) -> <Resource<T, Ser> as Render>::State
fn hydrate<const FROM_SERVER: bool>( self, cursor: &Cursor, position: &PositionState, ) -> <Resource<T, Ser> as Render>::State
ยงfn into_owned(self) -> <Resource<T, Ser> as RenderHtml>::Owned
fn into_owned(self) -> <Resource<T, Ser> as RenderHtml>::Owned
'static
.ยงconst EXISTS: bool = true
const EXISTS: bool = true
ยงfn to_html_branching(self) -> Stringwhere
Self: Sized,
fn to_html_branching(self) -> Stringwhere
Self: Sized,
ยงfn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_in_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order(self) -> StreamBuilderwhere
Self: Sized,
ยงfn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
fn to_html_stream_out_of_order_branching(self) -> StreamBuilderwhere
Self: Sized,
ยงfn hydrate_async(
self,
cursor: &Cursor,
position: &PositionState,
) -> impl Future<Output = Self::State>
fn hydrate_async( self, cursor: &Cursor, position: &PositionState, ) -> impl Future<Output = Self::State>
ยงfn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
fn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate
, beginning at the given element.ยงfn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
fn hydrate_from_position<const FROM_SERVER: bool>(
self,
el: &Element,
position: Position,
) -> Self::Statewhere
Self: Sized,
RenderHtml::hydrate
, beginning at the given element and position.ยงimpl<T, Ser> Write for Resource<T, Ser>
impl<T, Ser> Write for Resource<T, Ser>
ยงfn try_write(&self) -> Option<impl UntrackableGuard>
fn try_write(&self) -> Option<impl UntrackableGuard>
None
if the signal has already been disposed.ยงfn try_write_untracked(&self) -> Option<impl DerefMut>
fn try_write_untracked(&self) -> Option<impl DerefMut>
None
if the signal has already been disposed.ยงfn write(&self) -> impl UntrackableGuard
fn write(&self) -> impl UntrackableGuard
ยงfn write_untracked(&self) -> impl DerefMut
fn write_untracked(&self) -> impl DerefMut
impl<T, Ser> Copy for Resource<T, Ser>
Auto Trait Implementationsยง
impl<T, Ser> Freeze for Resource<T, Ser>
impl<T, Ser> RefUnwindSafe for Resource<T, Ser>where
Ser: RefUnwindSafe,
impl<T, Ser> Send for Resource<T, Ser>where
Ser: Send,
impl<T, Ser> Sync for Resource<T, Ser>where
Ser: Sync,
impl<T, Ser> Unpin for Resource<T, Ser>where
Ser: Unpin,
impl<T, Ser> UnwindSafe for Resource<T, Ser>where
Ser: UnwindSafe,
Blanket Implementationsยง
Sourceยงimpl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Sourceยงfn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Sourceยงfn adapt_into(self) -> D
fn adapt_into(self) -> D
ยงimpl<T> ArchivePointee for T
impl<T> ArchivePointee for T
ยงtype ArchivedMetadata = ()
type ArchivedMetadata = ()
ยงfn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Sourceยงimpl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Sourceยงfn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Sourceยงimpl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Sourceยงfn arrays_into(self) -> C
fn arrays_into(self) -> C
ยงimpl<V, Key, Sig, T> BindAttribute<Key, Sig, T> for Vwhere
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>,
impl<V, Key, Sig, T> BindAttribute<Key, Sig, T> for Vwhere
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>,
ยงtype Output = <V as AddAnyAttr>::Output<Bind<Key, T, <Sig as IntoSplitSignal>::Read, <Sig as IntoSplitSignal>::Write>>
type Output = <V as AddAnyAttr>::Output<Bind<Key, T, <Sig as IntoSplitSignal>::Read, <Sig as IntoSplitSignal>::Write>>
ยงfn bind(
self,
key: Key,
signal: Sig,
) -> <V as BindAttribute<Key, Sig, T>>::Output
fn bind( self, key: Key, signal: Sig, ) -> <V as BindAttribute<Key, Sig, T>>::Output
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<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Sourceยงtype Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters
when converting.Sourceยงfn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Sourceยงimpl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Sourceยงfn components_from(colors: C) -> T
fn components_from(colors: C) -> T
ยงimpl<T, K, V> CustomAttribute<K, V> for Twhere
T: AddAnyAttr,
K: CustomAttributeKey,
V: AttributeValue,
impl<T, K, V> CustomAttribute<K, V> for Twhere
T: AddAnyAttr,
K: CustomAttributeKey,
V: AttributeValue,
ยงimpl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
ยงfn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
ยงimpl<V, T, P, D> DirectiveAttribute<T, P, D> for Vwhere
V: AddAnyAttr,
D: IntoDirective<T, P>,
P: Clone + 'static,
T: 'static,
impl<V, T, P, D> DirectiveAttribute<T, P, D> for Vwhere
V: AddAnyAttr,
D: IntoDirective<T, P>,
P: Clone + 'static,
T: 'static,
ยงtype Output = <V as AddAnyAttr>::Output<Directive<T, D, P>>
type Output = <V as AddAnyAttr>::Output<Directive<T, D, P>>
ยงfn directive(
self,
handler: D,
param: P,
) -> <V as DirectiveAttribute<T, P, D>>::Output
fn directive( self, handler: D, param: P, ) -> <V as DirectiveAttribute<T, P, D>>::Output
ยงimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
ยงfn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.ยงfn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.ยงfn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
โs vtable from &Trait
โs.ยงfn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
โs vtable from &mut Trait
โs.ยงimpl<T> DowncastSend for T
impl<T> DowncastSend for T
ยงimpl<T> DowncastSync for T
impl<T> DowncastSync for T
Sourceยงimpl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Sourceยงfn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle
.Sourceยงimpl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Sourceยงfn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other
into Self
, while performing the appropriate scaling,
rounding and clamping.ยงimpl<T> Instrument for T
impl<T> Instrument for T
ยงfn instrument(self, span: Span) -> Instrumented<Self> โ
fn instrument(self, span: Span) -> Instrumented<Self> โ
Sourceยงimpl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Sourceยงfn into_angle(self) -> U
fn into_angle(self) -> U
T
.ยงimpl<T> IntoAny for Twhere
T: Send + RenderHtml,
impl<T> IntoAny for Twhere
T: Send + RenderHtml,
Sourceยงimpl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Sourceยงtype Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters
when converting.Sourceยงfn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.Sourceยงimpl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Sourceยงfn into_color(self) -> U
fn into_color(self) -> U
Sourceยงimpl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Sourceยงfn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
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> IntoMaybeErased for Twhere
T: RenderHtml,
impl<T> IntoMaybeErased for Twhere
T: RenderHtml,
ยงfn into_maybe_erased(self) -> <T as IntoMaybeErased>::Output
fn into_maybe_erased(self) -> <T as IntoMaybeErased>::Output
ยงimpl<T> IntoRender for Twhere
T: Render,
impl<T> IntoRender for Twhere
T: Render,
ยงfn into_render(self) -> <T as IntoRender>::Output
fn into_render(self) -> <T as IntoRender>::Output
Sourceยงimpl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Sourceยงfn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self
into T
, while performing the appropriate scaling,
rounding and clamping.ยงimpl<T> Pointable for T
impl<T> Pointable for T
ยงimpl<T> Pointee for T
impl<T> Pointee for T
ยงimpl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
ยงimpl<T> Read for Twhere
T: Track + ReadUntracked,
impl<T> Read for Twhere
T: Track + ReadUntracked,
ยงimpl<T> SerializableKey for T
impl<T> SerializableKey for T
ยงimpl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
ยงfn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
ยงfn into_taken(self) -> T
fn into_taken(self) -> T
Sourceยงimpl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Sourceยงtype Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors
fails to cast.Sourceยงfn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Sourceยงimpl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Sourceยงfn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains
the unclamped color. Read moreSourceยงimpl<C, U> UintsFrom<C> for Uwhere
C: IntoUints<U>,
impl<C, U> UintsFrom<C> for Uwhere
C: IntoUints<U>,
Sourceยงfn uints_from(colors: C) -> U
fn uints_from(colors: C) -> U
Sourceยงimpl<C, U> UintsInto<C> for Uwhere
C: FromUints<U>,
impl<C, U> UintsInto<C> for Uwhere
C: FromUints<U>,
Sourceยงfn uints_into(self) -> C
fn uints_into(self) -> C
ยงimpl<T> Update for Twhere
T: Write,
impl<T> Update for Twhere
T: Write,
ยงfn try_maybe_update<U>(
&self,
fun: impl FnOnce(&mut <T as Update>::Value) -> (bool, U),
) -> Option<U>
fn try_maybe_update<U>( &self, fun: impl FnOnce(&mut <T as Update>::Value) -> (bool, U), ) -> Option<U>
(true, _)
, and returns the value returned by the update function,
or None
if the signal has already been disposed.ยงfn update(&self, fun: impl FnOnce(&mut Self::Value))
fn update(&self, fun: impl FnOnce(&mut Self::Value))
ยงfn maybe_update(&self, fun: impl FnOnce(&mut Self::Value) -> bool)
fn maybe_update(&self, fun: impl FnOnce(&mut Self::Value) -> bool)
true
.ยงfn try_update<U>(&self, fun: impl FnOnce(&mut Self::Value) -> U) -> Option<U>
fn try_update<U>(&self, fun: impl FnOnce(&mut Self::Value) -> U) -> Option<U>
None
if the signal has already been disposed.ยงimpl<T> UpdateUntracked for Twhere
T: Write,
impl<T> UpdateUntracked for Twhere
T: Write,
ยงfn try_update_untracked<U>(
&self,
fun: impl FnOnce(&mut <T as UpdateUntracked>::Value) -> U,
) -> Option<U>
fn try_update_untracked<U>( &self, fun: impl FnOnce(&mut <T as UpdateUntracked>::Value) -> U, ) -> Option<U>
None
if the signal has already been disposed.
Does not notify subscribers that the signal has changed.ยงfn update_untracked<U>(&self, fun: impl FnOnce(&mut Self::Value) -> U) -> U
fn update_untracked<U>(&self, fun: impl FnOnce(&mut Self::Value) -> U) -> U
ยงimpl<T> With for Twhere
T: Read,
impl<T> With for Twhere
T: Read,
ยงimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
ยงfn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> โwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> โwhere
S: Into<Dispatch>,
ยงfn with_current_subscriber(self) -> WithDispatch<Self> โ
fn with_current_subscriber(self) -> WithDispatch<Self> โ
ยงimpl<T> WithUntracked for Twhere
T: DefinedAt + ReadUntracked,
impl<T> WithUntracked for Twhere
T: DefinedAt + ReadUntracked,
ยงtype Value = <<T as ReadUntracked>::Value as Deref>::Target
type Value = <<T as ReadUntracked>::Value as Deref>::Target
ยงfn try_with_untracked<U>(
&self,
fun: impl FnOnce(&<T as WithUntracked>::Value) -> U,
) -> Option<U>
fn try_with_untracked<U>( &self, fun: impl FnOnce(&<T as WithUntracked>::Value) -> U, ) -> Option<U>
None
if the signal has already been disposed.