Int

Struct Int 

Source
pub struct Int;
Expand description

An unbounded, mathematical integer.

This type cannot be only be constructed in logical or ghost code.

§Integers in pearlite

Note that in pearlite, all integer literals are of type Int:

let x = 1i32;
//             ↓ need to use the view operator to convert `i32` to `Int`
proof_assert!(x@ == 1);

You can use the usual operators on integers: +, -, *, / and %.

Note that those operators are not available in ghost code.

Implementations§

Source§

impl Int

Source

pub fn new(value: i128) -> Ghost<Self>

Create a new Int value

The result is wrapped in a Ghost, so that it can only be access inside a ghost! block.

You should not have to use this method directly: instead, use the int suffix inside of a ghost block:

let x: Ghost<Int> = ghost!(1int);
ghost! {
    let y: Int = 2int;
};

Trait Implementations§

Source§

impl Add for Int

Source§

type Output = Int

The resulting type after applying the + operator.
Source§

fn add(self, other: Int) -> Self

Performs the + operation. Read more
Source§

impl AddLogic for Int

Source§

impl Clone for Int

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl DeepModel for Int

Source§

impl Div for Int

Source§

type Output = Int

The resulting type after applying the / operator.
Source§

fn div(self, other: Int) -> Self

Performs the / operation. Read more
Source§

impl DivLogic for Int

Source§

impl<T> IndexLogic<Int> for [T]

Source§

type Item = T

Source§

impl<T, const N: usize> IndexLogic<Int> for [T; N]

Source§

type Item = T

Source§

impl<T> IndexLogic<Int> for Seq<T>

Source§

type Item = T

Source§

impl<T> IndexLogic<Int> for Vec<T>

Available on non-crate feature nightly only.

Dummy impls that don’t use the unstable trait Allocator

Source§

type Item = T

Source§

impl<T> IndexLogic<Int> for VecDeque<T>

Source§

type Item = T

Source§

impl Mul for Int

Source§

type Output = Int

The resulting type after applying the * operator.
Source§

fn mul(self, other: Int) -> Self

Performs the * operation. Read more
Source§

impl MulLogic for Int

Source§

impl Neg for Int

Source§

type Output = Int

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl NegLogic for Int

Source§

impl PartialEq for Int

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Int

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
Source§

fn lt(&self, other: &Self) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
Source§

fn le(&self, other: &Self) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
Source§

fn gt(&self, other: &Self) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
Source§

fn ge(&self, other: &Self) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Rem for Int

Source§

type Output = Int

The resulting type after applying the % operator.
Source§

fn rem(self, other: Int) -> Self

Performs the % operation. Read more
Source§

impl RemLogic for Int

Source§

impl Sub for Int

Source§

type Output = Int

The resulting type after applying the - operator.
Source§

fn sub(self, other: Int) -> Self

Performs the - operation. Read more
Source§

impl SubLogic for Int

Source§

impl Copy for Int

Source§

impl OrdLogic for Int

Source§

impl Plain for Int

Source§

impl WellFounded for Int

Auto Trait Implementations§

§

impl Freeze for Int

§

impl RefUnwindSafe for Int

§

impl Send for Int

§

impl Sync for Int

§

impl Unpin for Int

§

impl UnwindSafe for Int

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.

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.

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.
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.
Source§

impl<F> FnGhost for F