Skip to main content

Integer

Enum Integer 

Source
pub enum Integer<'a> {
    Small {
        v: i64,
    },
    Big {
        raw: BigInt<'a>,
    },
}

Variants§

§

Small

Fields

§

Big

Fields

§raw: BigInt<'a>

Implementations§

Source§

impl<'a> Integer<'a>

Source

pub fn arrow_raw(self) -> BigInt<'a>

Source

pub fn arrow_v(self) -> i64

Source

pub fn arrow_Small_v(self) -> i64

Source

pub fn arrow_Big_raw(self) -> BigInt<'a>

Source§

impl<'a> Integer<'a>

Source

pub const exec fn from_i64(v: i64) -> Self

Constructs the exact ASN.1 INTEGER value represented by an i64.

Source

pub exec fn as_i64(&self) -> value : Option<i64>

ensures
value matches Some(v) ==> self.deep_view() == v as int,

Returns the value as an i64 when it is represented by the small variant.

Source

pub exec fn in_i64_range<const HAS_MIN: bool, const MIN: i64, const HAS_MAX: bool, const MAX: i64>( &self, ) -> ok : bool

ensures
ok
    == ({
        &&& HAS_MIN ==> MIN as int <= self.deep_view()
        &&& HAS_MAX ==> self.deep_view() <= MAX as int

    }),

Tests an inclusive interval whose endpoints are representable as i64.

Trait Implementations§

Source§

impl<'i> ByteLen<Integer<'i>> for EnumeratedFmt

Source§

exec fn length(&self, v: &Enumerated<'i>) -> usize

Source§

fn exec_inv(&self) -> bool

Source§

impl<'i> ByteLen<Integer<'i>> for IntegerFmt

Source§

exec fn length(&self, v: &Integer<'i>) -> usize

Source§

fn exec_inv(&self) -> bool

Source§

impl<'a> Clone for Integer<'a>

Source§

fn clone(&self) -> Integer<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> DeepView for Integer<'a>

Source§

closed spec fn deep_view(&self) -> Self::V

Source§

type V = int

Source§

impl<'a> DerOrd<Integer<'a>> for EnumeratedFmt

Source§

proof fn lemma_der_serialize_len(&self, value: int)

Source§

open spec fn der_remaining(&self, value: int, state: IntegerDerState) -> Seq<u8>

{ IntegerFmt.der_remaining(value, state) }
Source§

open spec fn der_state_valid(&self, value: int, state: IntegerDerState) -> bool

{ IntegerFmt.der_state_valid(value, state) }
Source§

exec fn der_start(&self, i: &Integer<'a>) -> state : IntegerDerState

Source§

exec fn der_next(&self, i: &Integer<'a>, state: &mut IntegerDerState) -> next : Option<u8>

Source§

fn der_leq(&self, left: &T, right: &T) -> bool

Source§

impl<'a> DerOrd<Integer<'a>> for IntegerFmt

Source§

proof fn lemma_der_serialize_len(&self, value: int)

Source§

open spec fn der_remaining(&self, value: int, state: IntegerDerState) -> Seq<u8>

{ self.spec_serialize(value).skip(state.pos as int) }
Source§

open spec fn der_state_valid(&self, value: int, state: IntegerDerState) -> bool

{
    &&& state.pos <= state.len
    &&& state.len == self.spec_serialize(value).len()
    &&& state.small == (i64::MIN as int <= value <= i64::MAX as int)
    &&& state.small
        ==> {
            &&& state.len <= 9
            &&& state.bytes@.take(state.len as int) == self.spec_serialize(value)

        }

}
Source§

exec fn der_start(&self, i: &Integer<'a>) -> state : IntegerDerState

Source§

exec fn der_next(&self, i: &Integer<'a>, state: &mut IntegerDerState) -> next : Option<u8>

Source§

fn der_leq(&self, left: &T, right: &T) -> bool

Source§

impl<'a, const HAS_MIN: bool, const MIN: i64, const HAS_MAX: bool, const MAX: i64> Pred<Integer<'a>> for IntegerRange<HAS_MIN, MIN, HAS_MAX, MAX>

Source§

exec fn test(&self, value: &Integer<'a>) -> ok : bool

Source§

impl<'i> Prepare<Integer<'i>> for EnumeratedFmt

Source§

impl<'i> Prepare<Integer<'i>> for IntegerFmt

Source§

impl<'i, Output: OutputBuf> Serializer<Output, Integer<'i>> for EnumeratedFmt

Source§

exec fn serialize_into(&self, v: &Enumerated<'i>, obuf: &mut Output)

Source§

fn exec_inv(&self) -> bool

Source§

impl<'i, Output: OutputBuf> Serializer<Output, Integer<'i>> for IntegerFmt

Source§

exec fn serialize_into(&self, v: &Integer<'i>, obuf: &mut Output)

Source§

fn exec_inv(&self) -> bool

Source§

impl<'a> Copy for Integer<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Integer<'a>

§

impl<'a> RefUnwindSafe for Integer<'a>

§

impl<'a> Send for Integer<'a>

§

impl<'a> Sync for Integer<'a>

§

impl<'a> Unpin for Integer<'a>

§

impl<'a> UnsafeUnpin for Integer<'a>

§

impl<'a> UnwindSafe for Integer<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, VERUS_SPEC__A> FromSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: From<T>,

§

fn obeys_from_spec() -> bool

§

fn from_spec(v: T) -> VERUS_SPEC__A

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, VERUS_SPEC__A> IntoSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: Into<T>,

§

fn obeys_into_spec() -> bool

§

fn into_spec(self) -> T

§

impl<T, U> IntoSpecImpl<U> for T
where U: From<T>,

§

fn obeys_into_spec() -> bool

§

fn into_spec(self) -> U

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, VERUS_SPEC__A> TryFromSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: TryFrom<T>,

§

fn obeys_try_from_spec() -> bool

§

fn try_from_spec( v: T, ) -> Result<VERUS_SPEC__A, <VERUS_SPEC__A as TryFrom<T>>::Error>

Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T, VERUS_SPEC__A> TryIntoSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: TryInto<T>,

§

fn obeys_try_into_spec() -> bool

§

fn try_into_spec(self) -> Result<T, <VERUS_SPEC__A as TryInto<T>>::Error>

§

impl<T, U> TryIntoSpecImpl<U> for T
where U: TryFrom<T>,

§

fn obeys_try_into_spec() -> bool

§

fn try_into_spec(self) -> Result<U, <U as TryFrom<T>>::Error>

§

impl<A> SpecEq<&A> for A
where A: ?Sized,

§

impl<A> SpecEq<&mut A> for A
where A: ?Sized,

§

impl<A> SpecEq<A> for A
where A: ?Sized,

§

impl<A> SpecEq<Ghost<A>> for A

§

impl<A> SpecEq<Tracked<A>> for A