Struct rmp_futures::encode::MsgPackWriter
source · [−]pub struct MsgPackWriter<W> { /* private fields */ }Implementations
sourceimpl<W: AsyncWrite + Unpin> MsgPackWriter<W>
impl<W: AsyncWrite + Unpin> MsgPackWriter<W>
pub fn new(writer: W) -> Self
pub fn into_inner(self) -> W
pub async fn write_nil(self) -> IoResult<W>
pub async fn write_bool(self, val: bool) -> IoResult<W>
sourcepub async fn write_int(self, val: impl Into<EfficientInt>) -> IoResult<W>
pub async fn write_int(self, val: impl Into<EfficientInt>) -> IoResult<W>
Write any int (u8-u64,i8-i64) in the most efficient representation
pub async fn write_f32(self, val: f32) -> IoResult<W>
pub async fn write_f64(self, val: f64) -> IoResult<W>
pub async fn write_array_len(self, len: u32) -> IoResult<ArrayFuture<W>>
pub async fn write_map_len(self, len: u32) -> IoResult<MapFuture<W>>
sourcepub async fn write_bin_len(self, len: u32) -> IoResult<W>
pub async fn write_bin_len(self, len: u32) -> IoResult<W>
Encodes and attempts to write the most efficient binary array length representation TODO: return binwriter
sourcepub async fn write_bin(self, data: &[u8]) -> IoResult<W>
pub async fn write_bin(self, data: &[u8]) -> IoResult<W>
Encodes and attempts to write the most efficient binary representation
sourcepub async fn write_str_len(self, len: u32) -> IoResult<W>
pub async fn write_str_len(self, len: u32) -> IoResult<W>
Encodes and attempts to write the most efficient binary array length representation TODO: return str writer
sourcepub async fn write_str_bytes(self, string: &[u8]) -> IoResult<W>
pub async fn write_str_bytes(self, string: &[u8]) -> IoResult<W>
Encodes and attempts to write the most efficient binary representation
sourcepub async fn write_str(self, string: &str) -> IoResult<W>
pub async fn write_str(self, string: &str) -> IoResult<W>
Encodes and attempts to write the most efficient binary representation
sourcepub async fn write_ext_meta(self, len: u32, ty: i8) -> IoResult<W>
pub async fn write_ext_meta(self, len: u32, ty: i8) -> IoResult<W>
Encodes and attempts to write the most efficient ext metadata representation
Panics
Panics if ty is negative, because it is reserved for future MessagePack
extension including 2-byte type information.
pub async fn write_ext(self, data: &[u8], ty: i8) -> IoResult<W>
sourcepub async fn write_value(self, value: &Value) -> IoResult<W>where
W: Send,
pub async fn write_value(self, value: &Value) -> IoResult<W>where
W: Send,
Encodes and attempts to write a dynamic rmpv::Value
Panics
Panics if array or map length exceeds 2^32-1
sourcepub async fn write_value_ref(self, value: &ValueRef<'_>) -> IoResult<W>where
W: Send,
pub async fn write_value_ref(self, value: &ValueRef<'_>) -> IoResult<W>where
W: Send,
Encodes and attempts to write a dynamic rmpv::ValueRef
Panics
Panics if array or map length exceeds 2^32-1
pub fn write_value_dyn<'a>(
self,
value: &'a Value
) -> Pin<Box<dyn Future<Output = IoResult<W>> + Send + 'a>>where
W: Send + 'a,
pub fn write_value_ref_dyn<'a>(
self,
value: &'a ValueRef<'a>
) -> Pin<Box<dyn Future<Output = IoResult<W>> + Send + 'a>>where
W: Send + 'a,
Trait Implementations
sourceimpl<W: AsyncWrite + Unpin> AsyncWrite for MsgPackWriter<W>
impl<W: AsyncWrite + Unpin> AsyncWrite for MsgPackWriter<W>
sourcefn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8]
) -> Poll<IoResult<usize>>
fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8]
) -> Poll<IoResult<usize>>
Attempt to write bytes from buf into the object. Read more
sourcefn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<IoResult<()>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<IoResult<()>>
Attempt to flush the object, ensuring that any buffered data reach their destination. Read more
Auto Trait Implementations
impl<W> RefUnwindSafe for MsgPackWriter<W>where
W: RefUnwindSafe,
impl<W> Send for MsgPackWriter<W>where
W: Send,
impl<W> Sync for MsgPackWriter<W>where
W: Sync,
impl<W> Unpin for MsgPackWriter<W>where
W: Unpin,
impl<W> UnwindSafe for MsgPackWriter<W>where
W: UnwindSafe,
Blanket Implementations
impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
fn flush(&mut self) -> Flush<'_, Self>where
Self: Unpin,
fn flush(&mut self) -> Flush<'_, Self>where
Self: Unpin,
Creates a future which will entirely flush this AsyncWrite. Read more
fn close(&mut self) -> Close<'_, Self>where
Self: Unpin,
fn close(&mut self) -> Close<'_, Self>where
Self: Unpin,
Creates a future which will entirely close this AsyncWrite.
fn write(&'a mut self, buf: &'a [u8]) -> Write<'a, Self>where
Self: Unpin,
fn write(&'a mut self, buf: &'a [u8]) -> Write<'a, Self>where
Self: Unpin,
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more