Skip to main content

Context

Trait Context 

Source
pub trait Context<'a> {
    // Required methods
    unsafe fn key(&self) -> Option<Slice<'a>>;
    unsafe fn value(&self) -> Option<Slice<'a>>;
    unsafe fn entry(&self) -> Option<(Slice<'a>, Slice<'a>)>;
}
Expand description

Trait for providing context for policy to make decisions

Required Methods§

Source

unsafe fn key(&self) -> Option<Slice<'a>>

Get the current key as a slice that borrows from the iterator

§Safety
§Iterator Validity Requirement

Use valid() to check iterator state before calling this method.

§Lifetime Safety

The returned slice borrows data directly from the LevelDB iterator without copying. The data is only valid until the iterator is advanced to the next position or destroyed.

The caller must ensure that the returned slice does not outlive the iterator or any operation that would advance the iterator (such as calling next(), seek(), etc.). To keep the data longer, the slice should be cloned.

§Performance

This method provides zero-copy access to LevelDB data for maximum performance. Get the current key as a slice

Source

unsafe fn value(&self) -> Option<Slice<'a>>

Get the current value as a slice that borrows from the iterator

§Safety
§Iterator Validity Requirement

Use valid() to check iterator state before calling this method.

§Lifetime Safety

The returned slice borrows data directly from the LevelDB iterator without copying. The data is only valid until the iterator is advanced to the next position or destroyed.

The caller must ensure that the returned slice does not outlive the iterator or any operation that would advance the iterator (such as calling next(), seek(), etc.). To keep the data longer, the slice should be cloned.

§Performance

This method provides zero-copy access to LevelDB data for maximum performance.

Source

unsafe fn entry(&self) -> Option<(Slice<'a>, Slice<'a>)>

Get the current key-value pair as slices that borrow from the iterator

§Safety
§Iterator Validity Requirement

Use valid() to check iterator state before calling this method.

§Lifetime Safety

The returned slices borrow data directly from the LevelDB iterator without copying. The data is only valid until the iterator is advanced to the next position or destroyed.

The caller must ensure that the returned slices do not outlive the iterator or any operation that would advance the iterator (such as calling next(), seek(), etc.). To keep the data longer, the slice should be cloned.

§Performance

This method provides zero-copy access to LevelDB data for maximum performance.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a, T, D, P> Context<'a> for Iterator<'a, T, D, P>