pub enum Integer<'a> {
Small {
v: i64,
},
Big {
raw: BigInt<'a>,
},
}Variants§
Implementations§
Source§impl<'a> Integer<'a>
impl<'a> Integer<'a>
Sourcepub const exec fn from_i64(v: i64) -> Self
pub const exec fn from_i64(v: i64) -> Self
Constructs the exact ASN.1 INTEGER value represented by an i64.
Sourcepub exec fn as_i64(&self) -> value : Option<i64>
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.
Sourcepub exec fn in_i64_range<const HAS_MIN: bool, const MIN: i64, const HAS_MAX: bool, const MAX: i64>(
&self,
) -> ok : bool
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
impl<'i> ByteLen<Integer<'i>> for EnumeratedFmt
Source§impl<'i> ByteLen<Integer<'i>> for IntegerFmt
impl<'i> ByteLen<Integer<'i>> for IntegerFmt
Source§impl<'a> DerOrd<Integer<'a>> for EnumeratedFmt
impl<'a> DerOrd<Integer<'a>> for EnumeratedFmt
Source§proof fn lemma_der_serialize_len(&self, value: int)
proof fn lemma_der_serialize_len(&self, value: int)
Source§open spec fn der_remaining(&self, value: int, state: IntegerDerState) -> Seq<u8>
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
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
exec fn der_start(&self, i: &Integer<'a>) -> state : IntegerDerState
Source§impl<'a> DerOrd<Integer<'a>> for IntegerFmt
impl<'a> DerOrd<Integer<'a>> for IntegerFmt
Source§proof fn lemma_der_serialize_len(&self, value: int)
proof fn lemma_der_serialize_len(&self, value: int)
Source§open spec fn der_remaining(&self, value: int, state: IntegerDerState) -> Seq<u8>
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
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
exec fn der_start(&self, i: &Integer<'a>) -> state : IntegerDerState
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>
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§impl<'i> Prepare<Integer<'i>> for EnumeratedFmt
impl<'i> Prepare<Integer<'i>> for EnumeratedFmt
Source§impl<'i> Prepare<Integer<'i>> for IntegerFmt
impl<'i> Prepare<Integer<'i>> for IntegerFmt
Source§impl<'i, Output: OutputBuf> Serializer<Output, Integer<'i>> for EnumeratedFmt
impl<'i, Output: OutputBuf> Serializer<Output, Integer<'i>> for EnumeratedFmt
Source§exec fn serialize_into(&self, v: &Enumerated<'i>, obuf: &mut Output)
exec fn serialize_into(&self, v: &Enumerated<'i>, obuf: &mut Output)
Source§impl<'i, Output: OutputBuf> Serializer<Output, Integer<'i>> for IntegerFmt
impl<'i, Output: OutputBuf> Serializer<Output, Integer<'i>> for IntegerFmt
Source§exec fn serialize_into(&self, v: &Integer<'i>, obuf: &mut Output)
exec fn serialize_into(&self, v: &Integer<'i>, obuf: &mut Output)
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> 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