pub trait LLWriter: Send + Sync {
// Required method
fn ll_write(
&mut self,
path: &[&[u8]],
data: Bytes,
) -> Result<LLPath, LLError>;
}Expand description
Write bytes to a path.
This is the lowest-level write interface. Paths and data are just bytes. No parsing, no validation.
§Object Safety
This trait is object-safe: you can use Box<dyn LLWriter>.
Required Methods§
Sourcefn ll_write(&mut self, path: &[&[u8]], data: Bytes) -> Result<LLPath, LLError>
fn ll_write(&mut self, path: &[&[u8]], data: Bytes) -> Result<LLPath, LLError>
Write raw bytes to path components.
§Arguments
path- A slice of byte slices representing path components.data- The bytes to write.
§Returns
The “result path” as a sequence of byte components. This may be:
- The same as the input path (for simple stores)
- A different path (e.g., a generated ID, a handle for async operations)
§Example
use structfs_ll_store::{LLWriter, LLPath, LLError};
use bytes::Bytes;
fn create_user(store: &mut dyn LLWriter, data: &[u8]) -> Result<LLPath, LLError> {
store.ll_write(&[b"users"], Bytes::copy_from_slice(data))
}Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".