pub struct UnsignedLEB128;Expand description
Unsigned LEB128
Implementations§
Source§impl UnsignedLEB128
impl UnsignedLEB128
Sourcepub open spec fn spec_serialize_helper(v: UInt) -> Seq<u8>
pub open spec fn spec_serialize_helper(v: UInt) -> Seq<u8>
{
let lo = take_low_7_bits!(v);
let hi = v >> 7;
if hi == 0 {
seq![lo]
} else {
seq![set_high_8_bit!(lo)] + Self::spec_serialize_helper(hi)
}
}Helper function for spec_serialize
Trait Implementations§
Source§impl<'x, I, O> Combinator<'x, I, O> for UnsignedLEB128where
I: VestPublicInput,
O: VestPublicOutput<I>,
impl<'x, I, O> Combinator<'x, I, O> for UnsignedLEB128where
I: VestPublicInput,
O: VestPublicOutput<I>,
Source§exec fn serialize(
&self,
v: Self::SType,
buf: &mut O,
pos: usize,
) -> res : SResult<usize, SerializeError>
exec fn serialize( &self, v: Self::SType, buf: &mut O, pos: usize, ) -> res : SResult<usize, SerializeError>
Source§type SType = &'x u64
type SType = &'x u64
The input type of serialization, often a reference to
Self::Type.
For “structural” formats though (e.g., crate::regular::sequence::Pair and crate::regular::variant::Choice),
this is the tuple/sum of the corresponding Combinator::SType types.Source§fn ex_requires(&self) -> bool
fn ex_requires(&self) -> bool
Source§impl SecureSpecCombinator for UnsignedLEB128
impl SecureSpecCombinator for UnsignedLEB128
Source§open spec fn is_prefix_secure() -> bool
open spec fn is_prefix_secure() -> bool
{ true }Source§proof fn lemma_prefix_secure(&self, s1: Seq<u8>, s2: Seq<u8>)
proof fn lemma_prefix_secure(&self, s1: Seq<u8>, s2: Seq<u8>)
Source§proof fn lemma_parse_length(&self, s: Seq<u8>)
proof fn lemma_parse_length(&self, s: Seq<u8>)
Source§proof fn theorem_serialize_parse_roundtrip(&self, v: Self::Type)
proof fn theorem_serialize_parse_roundtrip(&self, v: Self::Type)
Source§proof fn theorem_parse_serialize_roundtrip(&self, s: Seq<u8>)
proof fn theorem_parse_serialize_roundtrip(&self, s: Seq<u8>)
Source§open spec fn is_productive(&self) -> bool
open spec fn is_productive(&self) -> bool
{ true }Source§proof fn lemma_parse_productive(&self, s: Seq<u8>)
proof fn lemma_parse_productive(&self, s: Seq<u8>)
Source§fn corollary_parse_surjective(&self, v: Self::Type)
fn corollary_parse_surjective(&self, v: Self::Type)
Source§fn corollary_serialize_injective_contraposition(
&self,
v1: Self::Type,
v2: Self::Type,
)
fn corollary_serialize_injective_contraposition( &self, v1: Self::Type, v2: Self::Type, )
Source§fn lemma_serialize_productive(&self, v: Self::Type)
fn lemma_serialize_productive(&self, v: Self::Type)
Source§impl SpecCombinator for UnsignedLEB128
impl SpecCombinator for UnsignedLEB128
Source§open spec fn spec_parse(&self, s: Seq<u8>) -> Option<(int, Self::Type)>
open spec fn spec_parse(&self, s: Seq<u8>) -> Option<(int, Self::Type)>
{
let v = take_low_7_bits!(s.first());
if s.len() != 0 {
if is_high_8_bit_set!(s.first()) {
match self.spec_parse(s.drop_first()) {
Some((n, v2)) => {
if n < usize::MAX
&& 0 < v2 <= n_bit_max_unsigned!(8 * uint_size!() - 7)
{
Some((n + 1, v2 << 7 | v as Self::Type))
} else {
None
}
}
None => None,
}
} else {
Some((1, v as Self::Type))
}
} else {
None
}
}Source§open spec fn spec_serialize(&self, v: Self::Type) -> Seq<u8>
open spec fn spec_serialize(&self, v: Self::Type) -> Seq<u8>
{ Self::spec_serialize_helper(v) }Source§impl View for UnsignedLEB128
impl View for UnsignedLEB128
Auto Trait Implementations§
impl Freeze for UnsignedLEB128
impl RefUnwindSafe for UnsignedLEB128
impl Send for UnsignedLEB128
impl Sync for UnsignedLEB128
impl Unpin for UnsignedLEB128
impl UnwindSafe for UnsignedLEB128
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
§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
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.