pub struct FileSink { /* private fields */ }Expand description
A file being written through a temporary sibling, renamed on
ContentSink::finish so a partial write never replaces a good file.
Implementations§
Source§impl FileSink
impl FileSink
Sourcepub fn create(destination: impl Into<PathBuf>) -> Result<Self, ContentError>
pub fn create(destination: impl Into<PathBuf>) -> Result<Self, ContentError>
Opens a staged writer for destination.
Sourcepub fn handle(self) -> ContentSinkRef
pub fn handle(self) -> ContentSinkRef
A shared handle to this sink.
Sourcepub fn destination(&self) -> &Path
pub fn destination(&self) -> &Path
The path this sink commits to.
Trait Implementations§
Source§impl ContentSink for FileSink
impl ContentSink for FileSink
Source§fn write_chunk(
&self,
bytes: Vec<u8>,
) -> ContentFuture<'_, Result<(), ContentError>>
fn write_chunk( &self, bytes: Vec<u8>, ) -> ContentFuture<'_, Result<(), ContentError>>
Appends
bytes to the destination.Source§fn finish(&self) -> ContentFuture<'_, Result<(), ContentError>>
fn finish(&self) -> ContentFuture<'_, Result<(), ContentError>>
Commits the destination. Dropping a sink without finishing it discards
whatever the provider allows it to discard.
Auto Trait Implementations§
impl !Freeze for FileSink
impl !RefUnwindSafe for FileSink
impl !Sync for FileSink
impl Send for FileSink
impl Unpin for FileSink
impl UnsafeUnpin for FileSink
impl UnwindSafe for FileSink
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