Struct BodyBytesMut

Source
pub struct BodyBytesMut<'a> { /* private fields */ }
Expand description

Write easely more to a body.

Implementations§

Source§

impl<'a> BodyBytesMut<'a>

Source

pub fn new(offset: usize, buffer: &'a mut Vec<u8>) -> Self

Creates a new body bytes.

This should only be used if you implement your own MessageBytes.

Source

pub fn resize(&mut self, len: usize)

Shrinks and grows the internal bytes.

Source

pub fn reserve(&mut self, len: usize)

Source

pub fn len(&self) -> usize

Returns the length of this body.

Source

pub fn serialize<S>(&mut self, value: &S) -> Result<()>
where S: Serialize + ?Sized,

Source

pub async fn from_file<P>(&mut self, path: P) -> Result<()>
where P: AsRef<Path>,

Trait Implementations§

Source§

impl BytesSeek for BodyBytesMut<'_>

Source§

fn position(&self) -> usize

Returns the internal position.
Source§

fn try_seek(&mut self, pos: usize) -> StdResult<(), SeekError>

Sets the internal position if possible.
Source§

fn seek(&mut self, pos: usize)

Sets the internal position.
Source§

fn try_advance(&mut self, adv: usize) -> Result<(), SeekError>

Advances the internal position if possible.
Source§

fn advance(&mut self, adv: usize)

Advances the internal position. Read more
Source§

impl BytesWrite for BodyBytesMut<'_>

Source§

fn as_mut(&mut self) -> &mut [u8]

Returns the entire slice mutably.
Source§

fn as_bytes(&self) -> Bytes<'_>

Returns the entire slice as a bytes struct setting the position of the new Bytes to 0.
Source§

fn remaining_mut(&mut self) -> &mut [u8]

Returns the remaining bytes mutably.
Source§

fn try_write(&mut self, slice: impl AsRef<[u8]>) -> StdResult<(), WriteError>

Writes a slice.
Source§

fn write(&mut self, slice: impl AsRef<[u8]>)

Writes a slice. Read more
Source§

fn try_write_u8(&mut self, num: u8) -> Result<(), WriteError>

Try to write u8 in big-endian.`
Source§

fn write_u8(&mut self, num: u8)

Writes an u8 in big-endian. Read more
Source§

fn try_write_u16(&mut self, num: u16) -> Result<(), WriteError>

Try to write u16 in big-endian.`
Source§

fn write_u16(&mut self, num: u16)

Writes an u16 in big-endian. Read more
Source§

fn try_write_u32(&mut self, num: u32) -> Result<(), WriteError>

Try to write u32 in big-endian.`
Source§

fn write_u32(&mut self, num: u32)

Writes an u32 in big-endian. Read more
Source§

fn try_write_u64(&mut self, num: u64) -> Result<(), WriteError>

Try to write u64 in big-endian.`
Source§

fn write_u64(&mut self, num: u64)

Writes an u64 in big-endian. Read more
Source§

fn try_write_u128(&mut self, num: u128) -> Result<(), WriteError>

Try to write u128 in big-endian.`
Source§

fn write_u128(&mut self, num: u128)

Writes an u128 in big-endian. Read more
Source§

fn try_write_i8(&mut self, num: i8) -> Result<(), WriteError>

Try to write i8 in big-endian.`
Source§

fn write_i8(&mut self, num: i8)

Writes an i8 in big-endian. Read more
Source§

fn try_write_i16(&mut self, num: i16) -> Result<(), WriteError>

Try to write i16 in big-endian.`
Source§

fn write_i16(&mut self, num: i16)

Writes an i16 in big-endian. Read more
Source§

fn try_write_i32(&mut self, num: i32) -> Result<(), WriteError>

Try to write i32 in big-endian.`
Source§

fn write_i32(&mut self, num: i32)

Writes an i32 in big-endian. Read more
Source§

fn try_write_i64(&mut self, num: i64) -> Result<(), WriteError>

Try to write i64 in big-endian.`
Source§

fn write_i64(&mut self, num: i64)

Writes an i64 in big-endian. Read more
Source§

fn try_write_i128(&mut self, num: i128) -> Result<(), WriteError>

Try to write i128 in big-endian.`
Source§

fn write_i128(&mut self, num: i128)

Writes an i128 in big-endian. Read more
Source§

fn try_write_f32(&mut self, num: f32) -> Result<(), WriteError>

Try to write f32 in big-endian.`
Source§

fn write_f32(&mut self, num: f32)

Writes an f32 in big-endian. Read more
Source§

fn try_write_f64(&mut self, num: f64) -> Result<(), WriteError>

Try to write f64 in big-endian.`
Source§

fn write_f64(&mut self, num: f64)

Writes an f64 in big-endian. Read more
Source§

fn try_write_le_u8(&mut self, num: u8) -> Result<(), WriteError>

Try to write u8 in little-endian.`
Source§

fn write_le_u8(&mut self, num: u8)

Writes an u8 in little-endian. Read more
Source§

fn try_write_le_u16(&mut self, num: u16) -> Result<(), WriteError>

Try to write u16 in little-endian.`
Source§

fn write_le_u16(&mut self, num: u16)

Writes an u16 in little-endian. Read more
Source§

fn try_write_le_u32(&mut self, num: u32) -> Result<(), WriteError>

Try to write u32 in little-endian.`
Source§

fn write_le_u32(&mut self, num: u32)

Writes an u32 in little-endian. Read more
Source§

fn try_write_le_u64(&mut self, num: u64) -> Result<(), WriteError>

Try to write u64 in little-endian.`
Source§

fn write_le_u64(&mut self, num: u64)

Writes an u64 in little-endian. Read more
Source§

fn try_write_le_u128(&mut self, num: u128) -> Result<(), WriteError>

Try to write u128 in little-endian.`
Source§

fn write_le_u128(&mut self, num: u128)

Writes an u128 in little-endian. Read more
Source§

fn try_write_le_i8(&mut self, num: i8) -> Result<(), WriteError>

Try to write i8 in little-endian.`
Source§

fn write_le_i8(&mut self, num: i8)

Writes an i8 in little-endian. Read more
Source§

fn try_write_le_i16(&mut self, num: i16) -> Result<(), WriteError>

Try to write i16 in little-endian.`
Source§

fn write_le_i16(&mut self, num: i16)

Writes an i16 in little-endian. Read more
Source§

fn try_write_le_i32(&mut self, num: i32) -> Result<(), WriteError>

Try to write i32 in little-endian.`
Source§

fn write_le_i32(&mut self, num: i32)

Writes an i32 in little-endian. Read more
Source§

fn try_write_le_i64(&mut self, num: i64) -> Result<(), WriteError>

Try to write i64 in little-endian.`
Source§

fn write_le_i64(&mut self, num: i64)

Writes an i64 in little-endian. Read more
Source§

fn try_write_le_i128(&mut self, num: i128) -> Result<(), WriteError>

Try to write i128 in little-endian.`
Source§

fn write_le_i128(&mut self, num: i128)

Writes an i128 in little-endian. Read more
Source§

fn try_write_le_f32(&mut self, num: f32) -> Result<(), WriteError>

Try to write f32 in little-endian.`
Source§

fn write_le_f32(&mut self, num: f32)

Writes an f32 in little-endian. Read more
Source§

fn try_write_le_f64(&mut self, num: f64) -> Result<(), WriteError>

Try to write f64 in little-endian.`
Source§

fn write_le_f64(&mut self, num: f64)

Writes an f64 in little-endian. Read more
Source§

impl Write for BodyBytesMut<'_>

Source§

fn write(&mut self, buf: &[u8]) -> Result<usize>

Writes a buffer into this writer, returning how many bytes were written. Read more
Source§

fn flush(&mut self) -> Result<()>

Flushes this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
1.36.0 · Source§

fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>

Like write, except that it writes from a slice of buffers. Read more
Source§

fn is_write_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Writer has an efficient write_vectored implementation. Read more
1.0.0 · Source§

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>

🔬This is a nightly-only experimental API. (write_all_vectored)
Attempts to write multiple buffers into this writer. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Writes a formatted string into this writer, returning any error encountered. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adapter for this instance of Write. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for BodyBytesMut<'a>

§

impl<'a> RefUnwindSafe for BodyBytesMut<'a>

§

impl<'a> Send for BodyBytesMut<'a>

§

impl<'a> Sync for BodyBytesMut<'a>

§

impl<'a> Unpin for BodyBytesMut<'a>

§

impl<'a> !UnwindSafe for BodyBytesMut<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more