pub struct Writer<F: AsyncRead + Unpin> { /* private fields */ }Expand description
Asar archive writer.
Implementations§
Source§impl<F: AsyncRead + Unpin> Writer<F>
impl<F: AsyncRead + Unpin> Writer<F>
Sourcepub fn add(&mut self, path: &str, content: F, size: u64)
pub fn add(&mut self, path: &str, content: F, size: u64)
Add an entry to the archive.
The entry’s parent directories are created recursively if they do not exist.
size should correspond with content. If size is smaller, exactly
size bytes will be written. If size is bigger, the
Writer::write method will fail. For convenience, you may want
to use add_sized.
§Panic
The method panics if normalised path contains no filename, or if the
path is already occupied by a previously inserted file.
Sourcepub fn add_empty_folder(&mut self, path: &str)
pub fn add_empty_folder(&mut self, path: &str)
Adds an empty folder recursively to the archive.
Sourcepub async fn write(self, dest: &mut (impl AsyncWrite + Unpin)) -> Result<()>
pub async fn write(self, dest: &mut (impl AsyncWrite + Unpin)) -> Result<()>
Finishes the archive and writes the content into dest.
pub fn into_stream(self) -> Result<impl Stream<Item = Result<Bytes>>>
Available on crate feature
stream only.Source§impl<F: AsyncRead + AsyncSeek + Unpin> Writer<F>
impl<F: AsyncRead + AsyncSeek + Unpin> Writer<F>
Sourcepub async fn add_sized(&mut self, path: &str, content: F) -> Result<()>
pub async fn add_sized(&mut self, path: &str, content: F) -> Result<()>
Add an entry to the archive.
Similar to Writer::add, but it uses AsyncSeekExt::seek to
determine the size of the content.
For more information see Writer::add.
pub async fn add_sized_with_integrity( &mut self, path: &str, content: F, ) -> Result<()>
Available on crate feature
integrity only.Trait Implementations§
Auto Trait Implementations§
impl<F> Freeze for Writer<F>
impl<F> RefUnwindSafe for Writer<F>where
F: RefUnwindSafe,
impl<F> Send for Writer<F>where
F: Send,
impl<F> Sync for Writer<F>where
F: Sync,
impl<F> Unpin for Writer<F>
impl<F> UnwindSafe for Writer<F>where
F: 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
Mutably borrows from an owned value. Read more