pub struct ArcLocalResource<T> { /* private fields */ }
Expand description
A reference-counted resource that only loads its data locally on the client.
Implementations§
Source§impl<T> ArcLocalResource<T>
impl<T> ArcLocalResource<T>
Sourcepub fn new<Fut>(fetcher: impl Fn() -> Fut + 'static) -> ArcLocalResource<T>where
T: 'static,
Fut: Future<Output = T> + 'static,
pub fn new<Fut>(fetcher: impl Fn() -> Fut + 'static) -> ArcLocalResource<T>where
T: 'static,
Fut: Future<Output = T> + 'static,
Creates the resource.
This will only begin loading data if you are on the client (i.e., if you do not have the
ssr
feature activated).
Trait Implementations§
Source§impl<T> Clone for ArcLocalResource<T>
impl<T> Clone for ArcLocalResource<T>
Source§fn clone(&self) -> ArcLocalResource<T>
fn clone(&self) -> ArcLocalResource<T>
Returns a copy 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 moreSource§impl<T> DefinedAt for ArcLocalResource<T>
impl<T> DefinedAt for ArcLocalResource<T>
Source§fn defined_at(&self) -> Option<&'static Location<'static>>
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<T> From<ArcLocalResource<T>> for LocalResource<T>where
T: 'static,
impl<T> From<ArcLocalResource<T>> for LocalResource<T>where
T: 'static,
Source§fn from(arc: ArcLocalResource<T>) -> LocalResource<T>
fn from(arc: ArcLocalResource<T>) -> LocalResource<T>
Converts to this type from the input type.
Source§impl<T> From<LocalResource<T>> for ArcLocalResource<T>where
T: 'static,
impl<T> From<LocalResource<T>> for ArcLocalResource<T>where
T: 'static,
Source§fn from(local: LocalResource<T>) -> ArcLocalResource<T>
fn from(local: LocalResource<T>) -> ArcLocalResource<T>
Converts to this type from the input type.
Source§impl<T> IntoFuture for ArcLocalResource<T>where
T: Clone + 'static,
impl<T> IntoFuture for ArcLocalResource<T>where
T: Clone + 'static,
Source§type IntoFuture = Map<AsyncDerivedFuture<SendWrapper<T>>, fn(_: SendWrapper<T>) -> T>
type IntoFuture = Map<AsyncDerivedFuture<SendWrapper<T>>, fn(_: SendWrapper<T>) -> T>
Which kind of future are we turning this into?
Source§fn into_future(self) -> <ArcLocalResource<T> as IntoFuture>::IntoFuture
fn into_future(self) -> <ArcLocalResource<T> as IntoFuture>::IntoFuture
Creates a future from a value. Read more
Source§impl<T> IsDisposed for ArcLocalResource<T>where
T: 'static,
impl<T> IsDisposed for ArcLocalResource<T>where
T: 'static,
Source§fn is_disposed(&self) -> bool
fn is_disposed(&self) -> bool
If
true
, the signal cannot be accessed without a panic.Source§impl<T> ReactiveNode for ArcLocalResource<T>
impl<T> ReactiveNode for ArcLocalResource<T>
Source§fn mark_dirty(&self)
fn mark_dirty(&self)
Notifies the source’s dependencies that it has changed.
Source§fn mark_check(&self)
fn mark_check(&self)
Notifies the source’s dependencies that it may have changed.
Source§fn mark_subscribers_check(&self)
fn mark_subscribers_check(&self)
Marks that all subscribers need to be checked.
Source§fn update_if_necessary(&self) -> bool
fn update_if_necessary(&self) -> bool
Regenerates the value for this node, if needed, and returns whether
it has actually changed or not.
Source§impl<T> ReadUntracked for ArcLocalResource<T>where
T: 'static,
impl<T> ReadUntracked for ArcLocalResource<T>where
T: 'static,
Source§type Value = ReadGuard<Option<SendWrapper<T>>, AsyncPlain<Option<SendWrapper<T>>>>
type Value = ReadGuard<Option<SendWrapper<T>>, AsyncPlain<Option<SendWrapper<T>>>>
The guard type that will be returned, which can be dereferenced to the value.
Source§fn try_read_untracked(
&self,
) -> Option<<ArcLocalResource<T> as ReadUntracked>::Value>
fn try_read_untracked( &self, ) -> Option<<ArcLocalResource<T> as ReadUntracked>::Value>
Returns the guard, or
None
if the signal has already been disposed.Source§fn read_untracked(&self) -> Self::Value
fn read_untracked(&self) -> Self::Value
Returns the guard. Read more
Source§fn custom_try_read(&self) -> Option<Option<Self::Value>>
fn custom_try_read(&self) -> Option<Option<Self::Value>>
This is a backdoor to allow overriding the
Read::try_read
implementation despite it being auto implemented. Read moreSource§impl<T> Source for ArcLocalResource<T>
impl<T> Source for ArcLocalResource<T>
Source§fn add_subscriber(&self, subscriber: AnySubscriber)
fn add_subscriber(&self, subscriber: AnySubscriber)
Adds a subscriber to this source’s list of dependencies.
Source§fn remove_subscriber(&self, subscriber: &AnySubscriber)
fn remove_subscriber(&self, subscriber: &AnySubscriber)
Removes a subscriber from this source’s list of dependencies.
Source§fn clear_subscribers(&self)
fn clear_subscribers(&self)
Remove all subscribers from this source’s list of dependencies.
Source§impl<T> Subscriber for ArcLocalResource<T>
impl<T> Subscriber for ArcLocalResource<T>
Source§fn add_source(&self, source: AnySource)
fn add_source(&self, source: AnySource)
Adds a subscriber to this subscriber’s list of dependencies.
Source§fn clear_sources(&self, subscriber: &AnySubscriber)
fn clear_sources(&self, subscriber: &AnySubscriber)
Clears the set of sources for this subscriber.
Source§impl<T> ToAnySource for ArcLocalResource<T>where
T: 'static,
impl<T> ToAnySource for ArcLocalResource<T>where
T: 'static,
Source§fn to_any_source(&self) -> AnySource
fn to_any_source(&self) -> AnySource
Converts this type to its type-erased equivalent.
Source§impl<T> ToAnySubscriber for ArcLocalResource<T>where
T: 'static,
impl<T> ToAnySubscriber for ArcLocalResource<T>where
T: 'static,
Source§fn to_any_subscriber(&self) -> AnySubscriber
fn to_any_subscriber(&self) -> AnySubscriber
Converts this type to its type-erased equivalent.
Auto Trait Implementations§
impl<T> Freeze for ArcLocalResource<T>
impl<T> !RefUnwindSafe for ArcLocalResource<T>
impl<T> Send for ArcLocalResource<T>
impl<T> Sync for ArcLocalResource<T>
impl<T> Unpin for ArcLocalResource<T>
impl<T> !UnwindSafe for ArcLocalResource<T>
Blanket Implementations§
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,
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 moreSource§impl<T> Read for Twhere
T: Track + ReadUntracked,
impl<T> Read for Twhere
T: Track + ReadUntracked,
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.
Source§impl<T> With for Twhere
T: Read,
impl<T> With for Twhere
T: Read,
Source§type Value = <<T as Read>::Value as Deref>::Target
type Value = <<T as Read>::Value as Deref>::Target
The type of the value contained in the signal.
Source§impl<T> WithUntracked for Twhere
T: DefinedAt + ReadUntracked,
impl<T> WithUntracked for Twhere
T: DefinedAt + ReadUntracked,
Source§type Value = <<T as ReadUntracked>::Value as Deref>::Target
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>
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.