pub enum Pointer<Index, ReducedIndex> {
OnDisk(u64),
Loaded {
previous_location: Option<u64>,
entry: Box<BTreeEntry<Index, ReducedIndex>>,
},
}
Expand description
A pointer to a location on-disk. May also contain the node already loaded.
Variants
OnDisk(u64)
The position on-disk of the node.
Loaded
Fields
entry: Box<BTreeEntry<Index, ReducedIndex>>
The loaded B-Tree entry.
An in-memory node that may have previously been saved on-disk.
Implementations
sourceimpl<Index: BinarySerialization + Debug + Clone + 'static, ReducedIndex: BinarySerialization + Debug + Clone + 'static> Pointer<Index, ReducedIndex>
impl<Index: BinarySerialization + Debug + Clone + 'static, ReducedIndex: BinarySerialization + Debug + Clone + 'static> Pointer<Index, ReducedIndex>
sourcepub fn load(
&mut self,
file: &mut dyn File,
validate_crc: bool,
vault: Option<&dyn AnyVault>,
cache: Option<&ChunkCache>,
current_order: Option<usize>
) -> Result<(), Error>
pub fn load(
&mut self,
file: &mut dyn File,
validate_crc: bool,
vault: Option<&dyn AnyVault>,
cache: Option<&ChunkCache>,
current_order: Option<usize>
) -> Result<(), Error>
Attempts to load the node from disk. If the node is already loaded, this function does nothing.
sourcepub fn get(&mut self) -> Option<&BTreeEntry<Index, ReducedIndex>>
pub fn get(&mut self) -> Option<&BTreeEntry<Index, ReducedIndex>>
Returns the previously-load()
ed entry.
sourcepub fn get_mut(&mut self) -> Option<&mut BTreeEntry<Index, ReducedIndex>>
pub fn get_mut(&mut self) -> Option<&mut BTreeEntry<Index, ReducedIndex>>
Returns the previously-load()
ed entry as a mutable reference.
sourcepub fn position(&self) -> Option<u64>
pub fn position(&self) -> Option<u64>
Returns the position on-disk of the node being pointed at, if the node has been saved before.
sourcepub fn map_loaded_entry<Output, CallerError: Display + Debug, Cb: FnOnce(&BTreeEntry<Index, ReducedIndex>, &mut dyn File) -> Result<Output, AbortError<CallerError>>>(
&self,
file: &mut dyn File,
vault: Option<&dyn AnyVault>,
cache: Option<&ChunkCache>,
current_order: Option<usize>,
callback: Cb
) -> Result<Output, AbortError<CallerError>>
pub fn map_loaded_entry<Output, CallerError: Display + Debug, Cb: FnOnce(&BTreeEntry<Index, ReducedIndex>, &mut dyn File) -> Result<Output, AbortError<CallerError>>>(
&self,
file: &mut dyn File,
vault: Option<&dyn AnyVault>,
cache: Option<&ChunkCache>,
current_order: Option<usize>,
callback: Cb
) -> Result<Output, AbortError<CallerError>>
Loads the pointed at node, if necessary, and invokes callback
with the
loaded node. This is useful in situations where the node isn’t needed to
be accessed mutably.
Trait Implementations
Auto Trait Implementations
impl<Index, ReducedIndex> RefUnwindSafe for Pointer<Index, ReducedIndex> where
Index: RefUnwindSafe,
ReducedIndex: RefUnwindSafe,
impl<Index, ReducedIndex> Send for Pointer<Index, ReducedIndex> where
Index: Send,
ReducedIndex: Send,
impl<Index, ReducedIndex> Sync for Pointer<Index, ReducedIndex> where
Index: Sync,
ReducedIndex: Sync,
impl<Index, ReducedIndex> Unpin for Pointer<Index, ReducedIndex>
impl<Index, ReducedIndex> UnwindSafe for Pointer<Index, ReducedIndex> where
Index: UnwindSafe,
ReducedIndex: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more