pub struct NodeCache(/* private fields */);Expand description
NodeCache is an in-memory cache of weak node references.
Implementations§
Source§impl NodeCache
impl NodeCache
pub fn new() -> Self
Sourcepub async fn get_or_reserve<'a>(&'a self, object_id: u64) -> GetResult<'a>
pub async fn get_or_reserve<'a>(&'a self, object_id: u64) -> GetResult<'a>
Gets a node in the cache, or reserves a placeholder in the cache to fill.
Only the first caller will receive a placeholder result; all callers after that will block until the placeholder is filled (or the placeholder is dropped, at which point the next caller would get a placeholder). Callers that receive a placeholder should later commit a node with NodeCache::commit.
Sourcepub fn remove(&self, node: &dyn FxNode)
pub fn remove(&self, node: &dyn FxNode)
Removes a node from the cache. Calling this on a placeholder is an error; instead, the placeholder should simply be dropped.
Sourcepub fn get(&self, object_id: u64) -> Option<Arc<dyn FxNode>>
pub fn get(&self, object_id: u64) -> Option<Arc<dyn FxNode>>
Returns the given node if present in the cache. This call should be handled with care. If it is being used to check if there is no live node version, then there should be precautions taken to ensure one will not be created in a race with this call or any of the resulting actions.
pub fn terminate(&self)
Auto Trait Implementations§
impl !Freeze for NodeCache
impl !RefUnwindSafe for NodeCache
impl Send for NodeCache
impl Sync for NodeCache
impl Unpin for NodeCache
impl UnsafeUnpin for NodeCache
impl UnwindSafe for NodeCache
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, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [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