pub struct VarInt(/* private fields */);Implementations§
Source§impl VarInt
impl VarInt
Sourcepub fn decode(bytes: &[u8]) -> VarInt
pub fn decode(bytes: &[u8]) -> VarInt
Decodes a variable integer into a 32-bit unsigned integer. bytes: A slice of bytes representing the variable integer.
Sourcepub fn encode(value: i32) -> Vec<u8> ⓘ
pub fn encode(value: i32) -> Vec<u8> ⓘ
Encodes a 32-bit integer into a variable integer. value: The 32-bit integer to encode.
Sourcepub fn encode_long(value: i64) -> Vec<u8> ⓘ
pub fn encode_long(value: i64) -> Vec<u8> ⓘ
Encodes a 64-bit integer into a variable integer. value: The 64-bit integer to encode.
Sourcepub fn decode_at(bytes: &[u8], index: usize) -> (VarInt, usize)
pub fn decode_at(bytes: &[u8], index: usize) -> (VarInt, usize)
Decodes a variable integer at a specific index. bytes: A slice of bytes representing the variable integer. index: The index to start reading the bytes from.
Sourcepub fn raw_at(bytes: &[u8], index: usize) -> Vec<u8> ⓘ
pub fn raw_at(bytes: &[u8], index: usize) -> Vec<u8> ⓘ
Reads the bytes of a variable integer. bytes: A slice of bytes representing the variable integer. index: The index to start reading the bytes from.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for VarInt
impl<'de> Deserialize<'de> for VarInt
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for VarInt
impl RefUnwindSafe for VarInt
impl Send for VarInt
impl Sync for VarInt
impl Unpin for VarInt
impl UnsafeUnpin for VarInt
impl UnwindSafe for VarInt
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