[−][src]Struct kiwi_schema::ByteBufferMut
A Kiwi byte buffer meant for writing.
Example usage:
let mut bb = kiwi_schema::ByteBufferMut::new(); bb.write_string("🍕"); bb.write_var_float(123.456); assert_eq!(bb.data(), [240, 159, 141, 149, 0, 133, 242, 210, 237]);
Implementations
impl ByteBufferMut
[src]
pub fn new() -> ByteBufferMut
[src]
Creates an empty ByteBufferMut ready for writing.
pub fn data(self) -> Vec<u8>
[src]
Consumes this buffer and returns the underlying backing store. Use this to get the data out when you're done writing to the buffer.
pub fn len(&self) -> usize
[src]
Returns the number of bytes written so far.
pub fn write_bool(&mut self, value: bool)
[src]
Write a boolean value to the end of the buffer.
pub fn write_byte(&mut self, value: u8)
[src]
Write a byte to the end of the buffer.
pub fn write_bytes(&mut self, value: &[u8])
[src]
Write a raw byte slice to the end of the buffer.
pub fn write_var_int(&mut self, value: i32)
[src]
Write a variable-length signed 32-bit integer to the end of the buffer.
pub fn write_var_uint(&mut self, value: u32)
[src]
Write a variable-length unsigned 32-bit integer to the end of the buffer.
pub fn write_var_float(&mut self, value: f32)
[src]
Write a variable-length 32-bit floating-point number to the end of the buffer.
pub fn write_string(&mut self, value: &str)
[src]
Write a UTF-8 string to the end of the buffer.
Auto Trait Implementations
impl RefUnwindSafe for ByteBufferMut
impl Send for ByteBufferMut
impl Sync for ByteBufferMut
impl Unpin for ByteBufferMut
impl UnwindSafe for ByteBufferMut
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,