Struct simple_bytes::Cursor
source · [−]pub struct Cursor<T> { /* private fields */ }
Expand description
A generic struct implementing BytesRead, BytesWrite and BytesSeek for different types.
In the background Bytes, BytesMut and BytesOwned use this.
Implementations
Returns the inner value as a mutable reference. Shrinking the inner len may lead to panics when reading or writing.
Returns the inner value, discarding how many bytes were read or written.
Trait Implementations
Returns the entire slice.
Returns all remaining bytes.
Reads a given length of bytes. Read more
Tries to read a given length without updating
the internal position. Returns None
if there are not enought
bytes remaining. Read more
Reads
2
bytes in big-endian converting them into an u16
. Read more
Reads
4
bytes in big-endian converting them into an u32
. Read more
Reads
8
bytes in big-endian converting them into an u64
. Read more
Reads
16
bytes in big-endian converting them into an u128
. Read more
Reads
2
bytes in big-endian converting them into an i16
. Read more
Reads
4
bytes in big-endian converting them into an i32
. Read more
Reads
8
bytes in big-endian converting them into an i64
. Read more
Reads
16
bytes in big-endian converting them into an i128
. Read more
Reads
4
bytes in big-endian converting them into an f32
. Read more
Reads
8
bytes in big-endian converting them into an f64
. Read more
Reads
1
bytes in little-endian converting them into an u8
. Read more
Reads
2
bytes in little-endian converting them into an u16
. Read more
Reads
4
bytes in little-endian converting them into an u32
. Read more
Reads
8
bytes in little-endian converting them into an u64
. Read more
Reads
16
bytes in little-endian converting them into an u128
. Read more
Reads
1
bytes in little-endian converting them into an i8
. Read more
Reads
2
bytes in little-endian converting them into an i16
. Read more
Reads
4
bytes in little-endian converting them into an i32
. Read more
Reads
8
bytes in little-endian converting them into an i64
. Read more
Reads
16
bytes in little-endian converting them into an i128
. Read more
Reads
4
bytes in little-endian converting them into an f32
. Read more
Reads
8
bytes in little-endian converting them into an f64
. Read more
Returns the entire slice mutably.
Returns the entire slice as a bytes struct
setting the position of the new Bytes to 0
. Read more
Returns the remaining bytes mutably.
Writes an u128
in big-endian. Read more
Writes an i128
in big-endian. Read more
Writes an u8
in little-endian. Read more
Writes an u16
in little-endian. Read more
Writes an u32
in little-endian. Read more
Writes an u64
in little-endian. Read more
Writes an u128
in little-endian. Read more
Writes an i8
in little-endian. Read more
Writes an i16
in little-endian. Read more
Writes an i32
in little-endian. Read more
Writes an i64
in little-endian. Read more
Writes an i128
in little-endian. Read more
Writes an f32
in little-endian. Read more
Writes an f64
in little-endian. Read more
Returns the entire slice mutably.
Returns the entire slice as a bytes struct
setting the position of the new Bytes to 0
. Read more
Returns the remaining bytes mutably.
Writes an u128
in big-endian. Read more
Writes an i128
in big-endian. Read more
Writes an u8
in little-endian. Read more
Writes an u16
in little-endian. Read more
Writes an u32
in little-endian. Read more
Writes an u64
in little-endian. Read more
Writes an u128
in little-endian. Read more
Writes an i8
in little-endian. Read more
Writes an i16
in little-endian. Read more
Writes an i32
in little-endian. Read more
Writes an i64
in little-endian. Read more
Writes an i128
in little-endian. Read more
Writes an f32
in little-endian. Read more
Writes an f64
in little-endian. Read more
Returns the remaining mutable slice.
If an empty slice is returned, this does not mean you can’t write anymore.
Write a slice. Allocates more space if the slice is
bigger than the Vec
.
Returns the entire slice mutably.
Returns the entire slice as a bytes struct
setting the position of the new Bytes to 0
. Read more
Writes an u128
in big-endian. Read more
Writes an i128
in big-endian. Read more
Writes an u8
in little-endian. Read more
Writes an u16
in little-endian. Read more
Writes an u32
in little-endian. Read more
Writes an u64
in little-endian. Read more
Writes an u128
in little-endian. Read more
Writes an i8
in little-endian. Read more
Writes an i16
in little-endian. Read more
Writes an i32
in little-endian. Read more
Writes an i64
in little-endian. Read more
Writes an i128
in little-endian. Read more
Writes an f32
in little-endian. Read more
Writes an f64
in little-endian. Read more
Returns the remaining mutable slice.
If an empty slice is returned, this does not mean you can’t write anymore.
Write a slice. Allocates more space if the slice is
bigger than the Vec
.
Returns the entire slice mutably.
Returns the entire slice as a bytes struct
setting the position of the new Bytes to 0
. Read more
Writes an u128
in big-endian. Read more
Writes an i128
in big-endian. Read more
Writes an u8
in little-endian. Read more
Writes an u16
in little-endian. Read more
Writes an u32
in little-endian. Read more
Writes an u64
in little-endian. Read more
Writes an u128
in little-endian. Read more
Writes an i8
in little-endian. Read more
Writes an i16
in little-endian. Read more
Writes an i32
in little-endian. Read more
Writes an i64
in little-endian. Read more
Writes an i128
in little-endian. Read more
Writes an f32
in little-endian. Read more
Writes an f64
in little-endian. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for Cursor<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for Cursor<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more