pub enum VarInt {
U8(u8),
U16(u16),
U32(u32),
U64(u64),
}Expand description
Enum representing a Bitcoin variable-length integer
Variants§
U8(u8)
u8 that’s [..=0xFC]
U16(u16)
u16 that’s [0xFD..=0xFFFF]
U32(u32)
u32 that’s [0x10000..=0xFFFFFFFF]
U64(u64)
u64 that’s [0x100000000..=0xFFFFFFFFFFFFFFFF]
Implementations§
Source§impl VarInt
impl VarInt
pub fn arrow_U8_0(self) -> u8
pub fn arrow_U16_0(self) -> u16
pub fn arrow_U32_0(self) -> u32
pub fn arrow_U64_0(self) -> u64
Source§impl VarInt
impl VarInt
Sourcepub open spec fn spec_as_usize(self) -> usize
pub open spec fn spec_as_usize(self) -> usize
{ self.spec_into() }Spec version of VarInt::as_usize
Trait Implementations§
Source§impl SpecTryFrom<(u8, Either<Seq<u8>, Either<u16, Either<u32, u64>>>)> for VarInt
impl SpecTryFrom<(u8, Either<Seq<u8>, Either<u16, Either<u32, u64>>>)> for VarInt
Source§open spec fn spec_try_from(
t: (u8, Either<Seq<u8>, Either<u16, Either<u32, u64>>>),
) -> Result<Self, Self::Error>
open spec fn spec_try_from( t: (u8, Either<Seq<u8>, Either<u16, Either<u32, u64>>>), ) -> Result<Self, Self::Error>
{
match t.1 {
inj_ord_choice_pat!(x, *, *, *) => {
if x == Seq::<u8>::empty() { Ok(VarInt::U8(t.0)) } else { Err(()) }
}
inj_ord_choice_pat!(*, x, *, *) => {
if t.0 == SPEC_TAG_U16 { Ok(VarInt::U16(x)) } else { Err(()) }
}
inj_ord_choice_pat!(*, *, x, *) => {
if t.0 == SPEC_TAG_U32 { Ok(VarInt::U32(x)) } else { Err(()) }
}
inj_ord_choice_pat!(*, *, *, x) => {
if t.0 == SPEC_TAG_U64 { Ok(VarInt::U64(x)) } else { Err(()) }
}
}
}Source§impl SpecTryFrom<VarInt> for (u8, Either<Seq<u8>, Either<u16, Either<u32, u64>>>)
impl SpecTryFrom<VarInt> for (u8, Either<Seq<u8>, Either<u16, Either<u32, u64>>>)
Source§open spec fn spec_try_from(t: VarInt) -> Result<Self, Self::Error>
open spec fn spec_try_from(t: VarInt) -> Result<Self, Self::Error>
{
match t {
VarInt::U8(t) => Ok((t, inj_ord_choice_result!(Seq::< u8 >::empty(), *, *, *))),
VarInt::U16(x) => Ok((SPEC_TAG_U16, inj_ord_choice_result!(*, x, *, *))),
VarInt::U32(x) => Ok((SPEC_TAG_U32, inj_ord_choice_result!(*, *, x, *))),
VarInt::U64(x) => Ok((SPEC_TAG_U64, inj_ord_choice_result!(*, *, *, x))),
}
}Source§impl<'x> TryFrom<&'x VarInt> for (&'x u8, Either<&'x &'x [u8], Either<&'x u16, Either<&'x u32, &'x u64>>>)
impl<'x> TryFrom<&'x VarInt> for (&'x u8, Either<&'x &'x [u8], Either<&'x u16, Either<&'x u32, &'x u64>>>)
impl Copy for VarInt
impl Eq for VarInt
impl StructuralPartialEq for VarInt
Auto Trait Implementations§
impl Freeze for VarInt
impl RefUnwindSafe for VarInt
impl Send for VarInt
impl Sync for VarInt
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, VERUS_SPEC__A> FromSpec<T> for VERUS_SPEC__Awhere
VERUS_SPEC__A: From<T>,
impl<T, VERUS_SPEC__A> FromSpec<T> for VERUS_SPEC__Awhere
VERUS_SPEC__A: From<T>,
fn obeys_from_spec() -> bool
fn from_spec(v: T) -> VERUS_SPEC__A
§impl<T, VERUS_SPEC__A> IntoSpec<T> for VERUS_SPEC__Awhere
VERUS_SPEC__A: Into<T>,
impl<T, VERUS_SPEC__A> IntoSpec<T> for VERUS_SPEC__Awhere
VERUS_SPEC__A: Into<T>,
fn obeys_into_spec() -> bool
fn into_spec(self) -> T
§impl<T, U> IntoSpecImpl<U> for Twhere
U: From<T>,
impl<T, U> IntoSpecImpl<U> for Twhere
U: From<T>,
fn obeys_into_spec() -> bool
fn into_spec(self) -> U
§impl<A, Rhs> PartialEqIs<Rhs> for A
impl<A, Rhs> PartialEqIs<Rhs> for A
§impl<Rhs, VERUS_SPEC__A> PartialEqSpec<Rhs> for VERUS_SPEC__A
impl<Rhs, VERUS_SPEC__A> PartialEqSpec<Rhs> for VERUS_SPEC__A
Source§impl<T, U> SpecTryInto<U> for Twhere
U: SpecTryFrom<T>,
impl<T, U> SpecTryInto<U> for Twhere
U: SpecTryFrom<T>,
Source§open spec fn spec_try_into(self) -> Result<U, <U as SpecTryFrom<T>>::Error>
open spec fn spec_try_into(self) -> Result<U, <U as SpecTryFrom<T>>::Error>
{ U::spec_try_from(self) }Source§type Error = <U as SpecTryFrom<T>>::Error
type Error = <U as SpecTryFrom<T>>::Error
The type returned in the event of a conversion error.