pub trait LinksStorageRef<T: LinkReference>: LinksStorage<T> {
// Required methods
fn get_link_ref(&self, index: T) -> Option<&GenericLink<T>>;
fn all_link_refs(&self) -> Vec<&GenericLink<T>>;
// Provided method
fn query_link_refs(
&self,
index: Option<T>,
source: Option<T>,
target: Option<T>,
) -> Vec<&GenericLink<T>> { ... }
}Expand description
Extension implemented by stores that keep links resident in memory and can therefore lend out references instead of copies.
Memory-mapped stores deliberately do not implement this: their
links are decoded from raw memory on read, so there is no stable
&GenericLink<T> to borrow.
Required Methods§
Sourcefn get_link_ref(&self, index: T) -> Option<&GenericLink<T>>
fn get_link_ref(&self, index: T) -> Option<&GenericLink<T>>
Borrows the link stored at index.
Sourcefn all_link_refs(&self) -> Vec<&GenericLink<T>>
fn all_link_refs(&self) -> Vec<&GenericLink<T>>
Borrows every link in the store.
Provided Methods§
Sourcefn query_link_refs(
&self,
index: Option<T>,
source: Option<T>,
target: Option<T>,
) -> Vec<&GenericLink<T>>
fn query_link_refs( &self, index: Option<T>, source: Option<T>, target: Option<T>, ) -> Vec<&GenericLink<T>>
Borrows every link matching the (optional) index/source/target pattern.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".