Skip to main content

LLReader

Trait LLReader 

Source
pub trait LLReader: Send + Sync {
    // Required method
    fn ll_read(&mut self, path: &[&[u8]]) -> Result<Option<Bytes>, LLError>;
}
Expand description

Read bytes from a path.

This is the lowest-level read interface. Paths are just byte sequences, and the returned data is just bytes. No parsing, no validation.

§Object Safety

This trait is object-safe: you can use Box<dyn LLReader>.

Required Methods§

Source

fn ll_read(&mut self, path: &[&[u8]]) -> Result<Option<Bytes>, LLError>

Read raw bytes from path components.

§Arguments
  • path - A slice of byte slices representing path components. No validation is performed - components are opaque bytes.
§Returns
  • Ok(None) - The path does not exist (not an error condition).
  • Ok(Some(bytes)) - The data at the path.
  • Err(LLError) - A transport or system error occurred.
§Example
use structfs_ll_store::{LLReader, LLError};
use bytes::Bytes;

fn read_user(store: &mut dyn LLReader, user_id: &str) -> Result<Option<Bytes>, LLError> {
    store.ll_read(&[b"users", user_id.as_bytes()])
}

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T: LLReader + ?Sized> LLReader for &mut T

Source§

fn ll_read(&mut self, path: &[&[u8]]) -> Result<Option<Bytes>, LLError>

Source§

impl<T: LLReader + ?Sized> LLReader for Box<T>

Source§

fn ll_read(&mut self, path: &[&[u8]]) -> Result<Option<Bytes>, LLError>

Implementors§