pub struct Writer {
pub options: WriterOptions,
/* private fields */
}Expand description
A struct to create an MTBL file from keys and values in sorted order.
Note that keys must be added in sorted order (by key), since they are
written to disk. To create an MTBL providing keys in non-sorted order, use a
Sorter.
To create a Writer with non-default options, see WriterOptions.
§Examples
let mut writer = Writer::create_from_path("/tmp/f.mtbl");
writer.add("a", dat_a);
writer.add("b", dat_b);Fields§
§options: WriterOptionsThe options used to create this MTBL file.
Implementations§
Source§impl Writer
impl Writer
Sourcepub fn create_from_path<T: AsRef<Path>>(path: T) -> IOResult<Writer>
pub fn create_from_path<T: AsRef<Path>>(path: T) -> IOResult<Writer>
Create an empty MTBL file at the given path.
Sourcepub fn create_from_file<T: 'static + AsRawFd>(file: T) -> IOResult<Writer>
pub fn create_from_file<T: 'static + AsRawFd>(file: T) -> IOResult<Writer>
Create an empty MTBL file from the given File.
Sourcepub fn as_raw_ptr(&mut self) -> *mut mtbl_writer
pub fn as_raw_ptr(&mut self) -> *mut mtbl_writer
Get the underlying mtbl_writer pointer.
Sourcepub fn add_all_sorted<T, U, I>(&mut self, iterable: I) -> Result<(), ()>
pub fn add_all_sorted<T, U, I>(&mut self, iterable: I) -> Result<(), ()>
Add all elements from a sorted iterator.
If the inputs are not all sorted (and after all the elements already added to the Writer), the result will be an Err, and that element and all further elements will not be written to the MTBL file.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Writer
impl !RefUnwindSafe for Writer
impl !Send for Writer
impl !Sync for Writer
impl Unpin for Writer
impl !UnwindSafe for Writer
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