Struct cacache::Writer [−][src]
pub struct Writer { /* fields omitted */ }Expand description
A reference to an open file writing to the cache.
Implementations
Creates a new writable file handle into the cache.
Example
use async_attributes;
use async_std::prelude::*;
#[async_attributes::main]
async fn main() -> cacache::Result<()> {
let mut fd = cacache::Writer::create("./my-cache", "my-key").await?;
fd.write_all(b"hello world").await.expect("Failed to write to cache");
// Data is not saved into the cache until you commit it.
fd.commit().await?;
Ok(())
}Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Writer
impl UnwindSafe for Writer
Blanket Implementations
impl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
impl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
Writes some bytes into the byte stream. Read more
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectoredFuture<'a, Self> where
Self: Unpin,
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectoredFuture<'a, Self> where
Self: Unpin,
Like [write()][AsyncWriteExt::write()], except that it writes a slice of buffers. Read more
Writes an entire buffer into the byte stream. Read more
Flushes the stream to ensure that all buffered contents reach their destination. Read more
impl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
impl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
Creates a future which will entirely flush this AsyncWrite. Read more
Creates a future which will entirely close this AsyncWrite.
Creates a future which will write bytes from buf into the object. Read more
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectored<'a, Self> where
Self: Unpin,
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectored<'a, Self> where
Self: Unpin,
Creates a future which will write bytes from bufs into the object using vectored
IO operations. Read more
Write data into this object. Read more
Mutably borrows from an owned value. Read more