pub struct LocalSink { /* private fields */ }Expand description
A local file opened for both directions, so the zoom pass reads back through the handle that wrote.
Implementations§
Source§impl LocalSink
impl LocalSink
pub fn create(path: impl AsRef<Path>) -> Result<Self>
Sourcepub fn discard(&mut self)
pub fn discard(&mut self)
Drop the handle and remove the file, without flushing what is staged.
What a writer that has given up wants: create truncated the path at
open, so leaving quietly still leaves a zero-magic stub behind that the
caller has to clean up. Nothing staged is worth writing to a file about
to be unlinked.
The handle goes first because Windows refuses to remove an open file. A removal that fails — the path already gone, a directory that is not writable — is not reported: this is the cleanup path of an error that is already on its way to the caller, and a second error would only hide the first.
Sourcepub fn as_source(&mut self) -> Result<SinkSource<'_>>
pub fn as_source(&mut self) -> Result<SinkSource<'_>>
A read view over what has been written, for the zoom pass. Flushes first, so the view never lags the writer.
Trait Implementations§
Source§impl ByteSink for LocalSink
impl ByteSink for LocalSink
fn path(&self) -> &str
Source§fn append(&mut self, data: &[u8]) -> Result<u64>
fn append(&mut self, data: &[u8]) -> Result<u64>
Source§fn write_all_at(&mut self, offset: u64, data: &[u8]) -> Result<()>
fn write_all_at(&mut self, offset: u64, data: &[u8]) -> Result<()>
Source§fn position(&self) -> u64
fn position(&self) -> u64
fn flush(&mut self) -> Result<()>
Auto Trait Implementations§
impl Freeze for LocalSink
impl RefUnwindSafe for LocalSink
impl Send for LocalSink
impl Sync for LocalSink
impl Unpin for LocalSink
impl UnsafeUnpin for LocalSink
impl UnwindSafe for LocalSink
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