pub struct WeakAccount(/* private fields */);
Expand description
Weak handle onto an Account
Like Account
, but doesn’t keep the account alive.
Must be upgraded before use.
Implementations§
Source§impl WeakAccount
impl WeakAccount
Sourcepub fn upgrade(&self) -> Result<Account>
pub fn upgrade(&self) -> Result<Account>
Upgrade to an Account
, if the account still exists
No-op WeakAccounts
can always be upgraded.
Sourcepub fn tracker(&self) -> Weak<MemoryQuotaTracker>
pub fn tracker(&self) -> Weak<MemoryQuotaTracker>
Obtains a handle onto the MemoryQuotaTracker
The returned handle is itself weak, and needs to be upgraded before use.
If the Account
was made a no-op MemoryQuotaTracker
(ie, one from MemoryQuotaTracker::new_noop
)
the returned value is always Weak
.
Sourcepub fn new_dangling() -> Self
pub fn new_dangling() -> Self
Creates a new dangling, dummy, WeakAccount
This can be used as a standin where a value of type WeakAccount
is needed.
The returned value cannot be upgraded to an Account
,
so cannot be used to claim memory or find a MemoryQuotaTracker
.
(If memory quota tracking is disabled at compile time,
the returned value can be upgraded, to a no-op Account
.)
Trait Implementations§
Source§impl Clone for WeakAccount
impl Clone for WeakAccount
Source§fn clone(&self) -> WeakAccount
fn clone(&self) -> WeakAccount
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for WeakAccount
impl RefUnwindSafe for WeakAccount
impl Send for WeakAccount
impl Sync for WeakAccount
impl Unpin for WeakAccount
impl UnwindSafe for WeakAccount
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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