Struct ordered_varint::Signed
source · [−]pub struct Signed(_);
Expand description
A signed integer value.
This type encodes values in the range -2.pow(123)..2.pow(123)
by using the
first 5 bits to denote a signed byte length
. This length ranges from
-15..=15
. The number of bytes read is always absolute, but the sign of the
length is used to determine the overall sign of the encoded value. The
remaining 3 bits of the first byte and any additional bytes are then
used to store the integer in big-endian encoding.
Trait Implementations
sourceimpl Ord for Signed
impl Ord for Signed
sourceimpl PartialOrd<Signed> for Signed
impl PartialOrd<Signed> for Signed
sourcefn partial_cmp(&self, other: &Signed) -> Option<Ordering>
fn partial_cmp(&self, other: &Signed) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl Variable for Signed
impl Variable for Signed
sourcefn encode_variable<W: Write>(&self, output: &mut W) -> Result<usize>
fn encode_variable<W: Write>(&self, output: &mut W) -> Result<usize>
Encodes self
into destination
, returning the number of bytes written upon success.
sourcefn decode_variable<R: Read>(input: R) -> Result<Self>
fn decode_variable<R: Read>(input: R) -> Result<Self>
Decodes a variable length value from source
.
sourcefn to_variable_vec(&self) -> Result<Vec<u8>>
fn to_variable_vec(&self) -> Result<Vec<u8>>
Encodes self
into a new Vec<u8>
.
impl Copy for Signed
impl Eq for Signed
impl StructuralEq for Signed
impl StructuralPartialEq for Signed
Auto Trait Implementations
impl RefUnwindSafe for Signed
impl Send for Signed
impl Sync for Signed
impl Unpin for Signed
impl UnwindSafe for Signed
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more