pub struct VarLong(pub i64);Expand description
A variable-length two’s-complement signed 64-bit integer.
VarLongs use one to ten bytes on the wire. Each byte carries seven payload bits; the most-significant bit is set on every byte except the last.
§Examples
use mcproto_types::{TypeCodec, basic::VarLong};
let mut encoded = Vec::new();
VarLong(9_223_372_036_854_775_000).encode(&mut encoded)?;
let mut input = encoded.as_slice();
assert_eq!(
VarLong::decode(&mut input)?,
VarLong(9_223_372_036_854_775_000),
);
assert!(input.is_empty());Tuple Fields§
§0: i64The integer value.
Trait Implementations§
impl Copy for VarLong
impl Eq for VarLong
impl StructuralPartialEq for VarLong
Auto Trait Implementations§
impl Freeze for VarLong
impl RefUnwindSafe for VarLong
impl Send for VarLong
impl Sync for VarLong
impl Unpin for VarLong
impl UnsafeUnpin for VarLong
impl UnwindSafe for VarLong
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