leptos::server

Struct ArcLocalResource

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

Source

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>

Source§

fn clone(&self) -> ArcLocalResource<T>

Returns a copy 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> DefinedAt for ArcLocalResource<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<T> From<ArcLocalResource<T>> for LocalResource<T>
where T: 'static,

Source§

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,

Source§

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,

Source§

type Output = T

The output that the future will produce on completion.
Source§

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

Creates a future from a value. Read more
Source§

impl<T> IsDisposed for ArcLocalResource<T>
where T: 'static,

Source§

fn is_disposed(&self) -> bool

If true, the signal cannot be accessed without a panic.
Source§

impl<T> ReactiveNode for ArcLocalResource<T>

Source§

fn mark_dirty(&self)

Notifies the source’s dependencies that it has changed.
Source§

fn mark_check(&self)

Notifies the source’s dependencies that it may have changed.
Source§

fn mark_subscribers_check(&self)

Marks that all subscribers need to be checked.
Source§

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,

Source§

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>

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

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

Returns the guard. Read more
Source§

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 more
Source§

impl<T> Source for ArcLocalResource<T>

Source§

fn add_subscriber(&self, subscriber: AnySubscriber)

Adds a subscriber to this source’s list of dependencies.
Source§

fn remove_subscriber(&self, subscriber: &AnySubscriber)

Removes a subscriber from this source’s list of dependencies.
Source§

fn clear_subscribers(&self)

Remove all subscribers from this source’s list of dependencies.
Source§

impl<T> Subscriber for ArcLocalResource<T>

Source§

fn add_source(&self, source: AnySource)

Adds a subscriber to this subscriber’s list of dependencies.
Source§

fn clear_sources(&self, subscriber: &AnySubscriber)

Clears the set of sources for this subscriber.
Source§

impl<T> ToAnySource for ArcLocalResource<T>
where T: 'static,

Source§

fn to_any_source(&self) -> AnySource

Converts this type to its type-erased equivalent.
Source§

impl<T> ToAnySubscriber for ArcLocalResource<T>
where T: 'static,

Source§

fn to_any_subscriber(&self) -> AnySubscriber

Converts this type to its type-erased equivalent.

Auto Trait Implementations§

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<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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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> 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> 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> Track for T

Source§

fn track(&self)

Subscribes to this signal in the current reactive scope without doing anything with its value.
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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T