pub struct StableWriter<M: StableMemory = CanisterStableMemory>(/* private fields */);๐Deprecated since 0.18.0: The
api::stable module has been moved to stable (crate root).Expand description
A writer to the stable memory.
Warning: This will overwrite any existing data in stable memory as it writes, so ensure you set
the offset value accordingly if you wish to preserve existing data.
Will attempt to grow the memory as it writes, and keep offsets and total capacity.
Implementationsยง
Sourceยงimpl<M: StableMemory> StableWriter<M>
impl<M: StableMemory> StableWriter<M>
Sourcepub fn with_memory(memory: M, offset: u64) -> Self
๐Deprecated since 0.18.0: The api::stable module has been moved to stable (crate root).
pub fn with_memory(memory: M, offset: u64) -> Self
api::stable module has been moved to stable (crate root).Creates a new StableWriter which writes to the selected memory
Sourcepub fn offset(&self) -> u64
๐Deprecated since 0.18.0: The api::stable module has been moved to stable (crate root).
pub fn offset(&self) -> u64
api::stable module has been moved to stable (crate root).Returns the offset of the writer
Trait Implementationsยง
Sourceยงimpl<M: Debug + StableMemory> Debug for StableWriter<M>
impl<M: Debug + StableMemory> Debug for StableWriter<M>
Sourceยงimpl Default for StableWriter
impl Default for StableWriter
Sourceยงimpl<M: StableMemory> From<StableIO<M>> for StableWriter<M>
impl<M: StableMemory> From<StableIO<M>> for StableWriter<M>
Sourceยงimpl<M: StableMemory> Seek for StableWriter<M>
impl<M: StableMemory> Seek for StableWriter<M>
Sourceยงfn seek(&mut self, pos: SeekFrom) -> Result<u64>
fn seek(&mut self, pos: SeekFrom) -> Result<u64>
Seek to an offset, in bytes, in a stream. Read more
1.55.0 ยท Sourceยงfn rewind(&mut self) -> Result<(), Error>
fn rewind(&mut self) -> Result<(), Error>
Rewind to the beginning of a stream. Read more
Sourceยงfn stream_len(&mut self) -> Result<u64, Error>
fn stream_len(&mut self) -> Result<u64, Error>
๐ฌThis is a nightly-only experimental API. (
seek_stream_len)Returns the length of this stream (in bytes). Read more
Sourceยงimpl<M: StableMemory> Write for StableWriter<M>
impl<M: StableMemory> Write for StableWriter<M>
Sourceยงfn write(&mut self, buf: &[u8]) -> Result<usize, Error>
fn write(&mut self, buf: &[u8]) -> Result<usize, Error>
Writes a buffer into this writer, returning how many bytes were written. Read more
Sourceยงfn flush(&mut self) -> Result<(), Error>
fn flush(&mut self) -> Result<(), Error>
Flushes this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
Sourceยงfn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
๐ฌThis is a nightly-only experimental API. (
can_vector)1.0.0 ยท Sourceยงfn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
Sourceยงfn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
๐ฌThis is a nightly-only experimental API. (
write_all_vectored)Attempts to write multiple buffers into this writer. Read more
Auto Trait Implementationsยง
impl<M> Freeze for StableWriter<M>where
M: Freeze,
impl<M> RefUnwindSafe for StableWriter<M>where
M: RefUnwindSafe,
impl<M> Send for StableWriter<M>where
M: Send,
impl<M> Sync for StableWriter<M>where
M: Sync,
impl<M> Unpin for StableWriter<M>where
M: Unpin,
impl<M> UnwindSafe for StableWriter<M>where
M: 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
Sourceยงimpl<T> StreamPosition for Twhere
T: Seek,
impl<T> StreamPosition for Twhere
T: Seek,
Sourceยงimpl<W> WriteBytesExt for W
impl<W> WriteBytesExt for W
Sourceยงfn write_u8(&mut self, n: u8) -> Result<(), Error>
fn write_u8(&mut self, n: u8) -> Result<(), Error>
Writes an unsigned 8 bit integer to the underlying writer. Read more
Sourceยงfn write_i8(&mut self, n: i8) -> Result<(), Error>
fn write_i8(&mut self, n: i8) -> Result<(), Error>
Writes a signed 8 bit integer to the underlying writer. Read more
Sourceยงfn write_u16<T>(&mut self, n: u16) -> Result<(), Error>where
T: ByteOrder,
fn write_u16<T>(&mut self, n: u16) -> Result<(), Error>where
T: ByteOrder,
Writes an unsigned 16 bit integer to the underlying writer. Read more
Sourceยงfn write_i16<T>(&mut self, n: i16) -> Result<(), Error>where
T: ByteOrder,
fn write_i16<T>(&mut self, n: i16) -> Result<(), Error>where
T: ByteOrder,
Writes a signed 16 bit integer to the underlying writer. Read more
Sourceยงfn write_u24<T>(&mut self, n: u32) -> Result<(), Error>where
T: ByteOrder,
fn write_u24<T>(&mut self, n: u32) -> Result<(), Error>where
T: ByteOrder,
Writes an unsigned 24 bit integer to the underlying writer. Read more
Sourceยงfn write_i24<T>(&mut self, n: i32) -> Result<(), Error>where
T: ByteOrder,
fn write_i24<T>(&mut self, n: i32) -> Result<(), Error>where
T: ByteOrder,
Writes a signed 24 bit integer to the underlying writer. Read more
Sourceยงfn write_u32<T>(&mut self, n: u32) -> Result<(), Error>where
T: ByteOrder,
fn write_u32<T>(&mut self, n: u32) -> Result<(), Error>where
T: ByteOrder,
Writes an unsigned 32 bit integer to the underlying writer. Read more
Sourceยงfn write_i32<T>(&mut self, n: i32) -> Result<(), Error>where
T: ByteOrder,
fn write_i32<T>(&mut self, n: i32) -> Result<(), Error>where
T: ByteOrder,
Writes a signed 32 bit integer to the underlying writer. Read more
Sourceยงfn write_u48<T>(&mut self, n: u64) -> Result<(), Error>where
T: ByteOrder,
fn write_u48<T>(&mut self, n: u64) -> Result<(), Error>where
T: ByteOrder,
Writes an unsigned 48 bit integer to the underlying writer. Read more
Sourceยงfn write_i48<T>(&mut self, n: i64) -> Result<(), Error>where
T: ByteOrder,
fn write_i48<T>(&mut self, n: i64) -> Result<(), Error>where
T: ByteOrder,
Writes a signed 48 bit integer to the underlying writer. Read more
Sourceยงfn write_u64<T>(&mut self, n: u64) -> Result<(), Error>where
T: ByteOrder,
fn write_u64<T>(&mut self, n: u64) -> Result<(), Error>where
T: ByteOrder,
Writes an unsigned 64 bit integer to the underlying writer. Read more
Sourceยงfn write_i64<T>(&mut self, n: i64) -> Result<(), Error>where
T: ByteOrder,
fn write_i64<T>(&mut self, n: i64) -> Result<(), Error>where
T: ByteOrder,
Writes a signed 64 bit integer to the underlying writer. Read more
Sourceยงfn write_u128<T>(&mut self, n: u128) -> Result<(), Error>where
T: ByteOrder,
fn write_u128<T>(&mut self, n: u128) -> Result<(), Error>where
T: ByteOrder,
Writes an unsigned 128 bit integer to the underlying writer.
Sourceยงfn write_i128<T>(&mut self, n: i128) -> Result<(), Error>where
T: ByteOrder,
fn write_i128<T>(&mut self, n: i128) -> Result<(), Error>where
T: ByteOrder,
Writes a signed 128 bit integer to the underlying writer.
Sourceยงfn write_uint<T>(&mut self, n: u64, nbytes: usize) -> Result<(), Error>where
T: ByteOrder,
fn write_uint<T>(&mut self, n: u64, nbytes: usize) -> Result<(), Error>where
T: ByteOrder,
Writes an unsigned n-bytes integer to the underlying writer. Read more
Sourceยงfn write_int<T>(&mut self, n: i64, nbytes: usize) -> Result<(), Error>where
T: ByteOrder,
fn write_int<T>(&mut self, n: i64, nbytes: usize) -> Result<(), Error>where
T: ByteOrder,
Writes a signed n-bytes integer to the underlying writer. Read more
Sourceยงfn write_uint128<T>(&mut self, n: u128, nbytes: usize) -> Result<(), Error>where
T: ByteOrder,
fn write_uint128<T>(&mut self, n: u128, nbytes: usize) -> Result<(), Error>where
T: ByteOrder,
Writes an unsigned n-bytes integer to the underlying writer. Read more
Sourceยงfn write_int128<T>(&mut self, n: i128, nbytes: usize) -> Result<(), Error>where
T: ByteOrder,
fn write_int128<T>(&mut self, n: i128, nbytes: usize) -> Result<(), Error>where
T: ByteOrder,
Writes a signed n-bytes integer to the underlying writer. Read more