pub struct Writer<W> { /* private fields */ }Expand description
A pseudo-shuffled SAF file writer.
Note that the writer has a fallible drop check.
See Writer::create and Writer::try_finish for more, as well as
the module docs for general usage..
Implementations§
Source§impl<W> Writer<W>
impl<W> Writer<W>
Sourcepub fn try_finish(self) -> Result<()>
pub fn try_finish(self) -> Result<()>
Consumes the writer fallibly.
This can be use to drop the writer and handle an error in the drop. See Writer::create
for more information on when the writer can be dropped.
Source§impl Writer<BufWriter<File>>
impl Writer<BufWriter<File>>
Sourcepub fn create<P>(path: P, header: Header) -> Result<Self>
pub fn create<P>(path: P, header: Header) -> Result<Self>
Creates a new pseudo-shuffled SAF file writer.
Note that this will pre-allocate the full disk space needed to fit the data described in the header. If the path already exists, it will be overwritten. The header information will be written to the file.
Since the full file space is pre-allocated, and since data is not written sequentially,
it is considered an error if less sites are written than specified in the header.
This condition is checked when dropping the reader, and the drop check will panic if the
check is failed. See Writer::try_finish to handle the result of this check.
Sourcepub fn write_intersect<const D: usize, R, V>(
self,
intersect: Intersect<D, R, V>,
) -> Result<()>
pub fn write_intersect<const D: usize, R, V>( self, intersect: Intersect<D, R, V>, ) -> Result<()>
Writes an entire reader to the writer.
Assumes that the reader contains the appropriate number of sites.
Sourcepub fn write_site(&mut self, values: &[f32]) -> Result<()>
pub fn write_site(&mut self, values: &[f32]) -> Result<()>
Writes a single site to the writer.
No more sites can be written than specified in the header specified to Writer::create.
Also, the number of values in site must match the sum of the shape provided in the header.
If either of those conditions are not met, an error will be returned.
Sourcepub fn write_disjoint_site<I>(&mut self, values_iter: I) -> Result<()>
pub fn write_disjoint_site<I>(&mut self, values_iter: I) -> Result<()>
Writes a single site split across multiple slices to the writer.
The different slices here may for instance correspond to different populations. As for
Writer::write_site, no more sites can be than specified in the header specified to
Writer::create. The provided sites must match the shape provided in the header.
If either of those conditions are not met, an error will be returned.
Trait Implementations§
Auto Trait Implementations§
impl<W> Freeze for Writer<W>
impl<W> RefUnwindSafe for Writer<W>where
W: RefUnwindSafe,
impl<W> Send for Writer<W>where
W: Send,
impl<W> Sync for Writer<W>where
W: Sync,
impl<W> Unpin for Writer<W>where
W: Unpin,
impl<W> UnwindSafe for Writer<W>where
W: UnwindSafe,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more