#[repr(C)]pub struct StoreCallbacks {
pub get: extern "C" fn(ctx: *mut FFIContext, key: *const u8, key_len: usize, output: *mut BufferFFI) -> i32,
pub contains_key: extern "C" fn(ctx: *mut FFIContext, key: *const u8, key_len: usize, result: *mut u8) -> i32,
pub prefix: extern "C" fn(ctx: *mut FFIContext, prefix: *const u8, prefix_len: usize, iterator_out: *mut *mut StoreIteratorFFI) -> i32,
pub range: extern "C" fn(ctx: *mut FFIContext, start: *const u8, start_len: usize, start_bound_type: u8, end: *const u8, end_len: usize, end_bound_type: u8, iterator_out: *mut *mut StoreIteratorFFI) -> i32,
pub iterator_next: extern "C" fn(iterator: *mut StoreIteratorFFI, key_out: *mut BufferFFI, value_out: *mut BufferFFI) -> i32,
pub iterator_free: extern "C" fn(iterator: *mut StoreIteratorFFI),
}Expand description
Store access callbacks (read-only access to underlying store)
Fields§
§get: extern "C" fn(ctx: *mut FFIContext, key: *const u8, key_len: usize, output: *mut BufferFFI) -> i32Get a value from store by key
§Parameters
ctx: FFI contextkey: Key byteskey_len: Length of keyoutput: Buffer to receive value
§Returns
- 0 if value exists and retrieved, 1 if key not found, negative on error
contains_key: extern "C" fn(ctx: *mut FFIContext, key: *const u8, key_len: usize, result: *mut u8) -> i32Check if a key exists in store
§Parameters
ctx: FFI contextkey: Key byteskey_len: Length of keyresult: Pointer to receive result (1 if exists, 0 if not)
§Returns
- 0 on success, negative error code on failure
prefix: extern "C" fn(ctx: *mut FFIContext, prefix: *const u8, prefix_len: usize, iterator_out: *mut *mut StoreIteratorFFI) -> i32Create an iterator for store keys with a given prefix
§Parameters
ctx: FFI contextprefix: Prefix bytesprefix_len: Length of prefixiterator_out: Pointer to receive iterator handle
§Returns
- 0 on success, negative error code on failure
range: extern "C" fn(ctx: *mut FFIContext, start: *const u8, start_len: usize, start_bound_type: u8, end: *const u8, end_len: usize, end_bound_type: u8, iterator_out: *mut *mut StoreIteratorFFI) -> i32Create an iterator for store keys in a range
§Parameters
ctx: FFI contextstart: Start key bytesstart_len: Length of start keystart_bound_type: Bound type for start (0=Unbounded, 1=Included, 2=Excluded)end: End key bytesend_len: Length of end keyend_bound_type: Bound type for end (0=Unbounded, 1=Included, 2=Excluded)iterator_out: Pointer to receive iterator handle
§Returns
- 0 on success, negative error code on failure
iterator_next: extern "C" fn(iterator: *mut StoreIteratorFFI, key_out: *mut BufferFFI, value_out: *mut BufferFFI) -> i32Get the next key-value pair from a store iterator
§Parameters
iterator: Iterator handlekey_out: Buffer to receive keyvalue_out: Buffer to receive value
§Returns
- 0 on success, 1 if end of iteration, negative on error
iterator_free: extern "C" fn(iterator: *mut StoreIteratorFFI)Trait Implementations§
Source§impl Clone for StoreCallbacks
impl Clone for StoreCallbacks
Source§fn clone(&self) -> StoreCallbacks
fn clone(&self) -> StoreCallbacks
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for StoreCallbacks
Auto Trait Implementations§
impl Freeze for StoreCallbacks
impl RefUnwindSafe for StoreCallbacks
impl Send for StoreCallbacks
impl Sync for StoreCallbacks
impl Unpin for StoreCallbacks
impl UnsafeUnpin for StoreCallbacks
impl UnwindSafe for StoreCallbacks
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
Mutably borrows from an owned value. Read more