pub trait LogWriterExt: LogWriter {
// Provided methods
fn insert_generic<T>(
&self,
value: &T,
) -> Result<ValuePointer<Self::Id>, Either<T::Error, Error>>
where T: Type,
Self::Id: CheapClone + Debug { ... }
fn insert_with<E>(
&self,
vb: ValueBuilder<impl FnOnce(&mut VacantBuffer<'_>) -> Result<(), E>>,
) -> Result<ValuePointer<Self::Id>, Either<E, Error>>
where Self::Id: CheapClone + Debug { ... }
fn insert_generic_tombstone<T>(
&self,
value: &T,
) -> Result<ValuePointer<Self::Id>, Either<T::Error, Error>>
where T: Type,
Self::Id: CheapClone + Debug { ... }
fn insert_tombstone_with<E>(
&self,
vb: ValueBuilder<impl FnOnce(&mut VacantBuffer<'_>) -> Result<(), E>>,
) -> Result<ValuePointer<Self::Id>, Either<E, Error>>
where Self::Id: CheapClone + Debug { ... }
}Expand description
Provided Methods§
Sourcefn insert_generic<T>(
&self,
value: &T,
) -> Result<ValuePointer<Self::Id>, Either<T::Error, Error>>
fn insert_generic<T>( &self, value: &T, ) -> Result<ValuePointer<Self::Id>, Either<T::Error, Error>>
Inserts a generic value into the log.
§Example
use valog::{Builder, sync::ValueLog, LogWriterExt};
let log = Builder::new().with_capacity(1024).alloc::<ValueLog>(0).unwrap();
let vp = log.insert_generic(&"Hello, valog!".to_string()).unwrap();Sourcefn insert_with<E>(
&self,
vb: ValueBuilder<impl FnOnce(&mut VacantBuffer<'_>) -> Result<(), E>>,
) -> Result<ValuePointer<Self::Id>, Either<E, Error>>
fn insert_with<E>( &self, vb: ValueBuilder<impl FnOnce(&mut VacantBuffer<'_>) -> Result<(), E>>, ) -> Result<ValuePointer<Self::Id>, Either<E, Error>>
Inserts a value into the log with a builder, the value is built in place.
§Example
use valog::{Builder, sync::ValueLog, LogWriterExt, ValueBuilder, VacantBuffer};
let log = Builder::new().with_capacity(1024).alloc::<ValueLog>(0).unwrap();
let data = b"Hello, valog!";
let vb = ValueBuilder::new(data.len(), |buf: &mut VacantBuffer<'_>| {
buf.put_slice(data)
});
let vp = log.insert_with(vb).unwrap();Sourcefn insert_generic_tombstone<T>(
&self,
value: &T,
) -> Result<ValuePointer<Self::Id>, Either<T::Error, Error>>
fn insert_generic_tombstone<T>( &self, value: &T, ) -> Result<ValuePointer<Self::Id>, Either<T::Error, Error>>
Inserts a generic value into the log.
This method is almost the same as the insert_generic method, the only difference is that
this method will increases the discarded bytes of the log.
§Example
use valog::{Builder, sync::ValueLog, LogWriterExt};
let log = Builder::new().with_capacity(1024).alloc::<ValueLog>(0).unwrap();
let vp = log.insert_generic_tombstone(&"Hello, valog!".to_string()).unwrap();Sourcefn insert_tombstone_with<E>(
&self,
vb: ValueBuilder<impl FnOnce(&mut VacantBuffer<'_>) -> Result<(), E>>,
) -> Result<ValuePointer<Self::Id>, Either<E, Error>>
fn insert_tombstone_with<E>( &self, vb: ValueBuilder<impl FnOnce(&mut VacantBuffer<'_>) -> Result<(), E>>, ) -> Result<ValuePointer<Self::Id>, Either<E, Error>>
Inserts a value into the log with a builder, the value is built in place.
This method is almost the same as the insert_with method, the only difference is that
this method will increases the discarded bytes of the log.
§Example
use valog::{Builder, sync::ValueLog, LogWriterExt, ValueBuilder, VacantBuffer};
let log = Builder::new().with_capacity(1024).alloc::<ValueLog>(0).unwrap();
let data = b"Hello, valog!";
let vb = ValueBuilder::new(data.len(), |buf: &mut VacantBuffer<'_>| {
buf.put_slice(data)
});
let vp = log.insert_tombstone_with(vb).unwrap();Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.