Skip to main content

Widths

Struct Widths 

Source
pub struct Widths { /* private fields */ }
Expand description

How wide each thing in one rule is.

A rule is written at one width, the one its pattern’s opcode names, and the terms inside it may say another: (value.i64 x) under an add.i32 is a thirty two bit add of two sixty four bit registers, which is the shape every sext, zext and trunc in a lowering has. What a name stands at is fixed by the pattern, because the pattern is where a name is bound, and everywhere else reads it from here.

A bounded proof asks the same rule at a narrower width, and that scales every width in the rule by one ratio rather than flattening them all to one number. A rule that converts between widths still converts between widths when it is asked at eight bits, which it would not do if the narrow width were simply substituted everywhere.

Implementations§

Source§

impl Widths

Source

pub fn of(pattern: &Term) -> Widths

The widths one rule’s pattern fixes, at the width the rule is written in.

Source

pub fn at(pattern: &Term, asked: u32) -> Widths

The same, scaled to a width somebody asked for. This is what a bounded proof is made of.

Source

pub fn width(&self) -> u32

The width a term is at when nothing inside it says otherwise.

Source

pub fn natural(&self) -> u32

The width the rule is written in, which is the one it will run at.

Source

pub fn names(&self) -> impl Iterator<Item = (&str, u32)>

Every name the pattern binds and how wide it is, sorted.

Sorted rather than in the order the pattern binds them, because the query is something a test pins and a diff is easier to read than it is to regenerate.

Source

pub fn with(&self, name: &str, width: u32) -> Widths

These widths and one more name, which is how the replacement’s own meaning gets a width once it has been substituted into the specification for (result).

Trait Implementations§

Source§

impl Clone for Widths

Source§

fn clone(&self) -> Widths

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 Debug for Widths

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Widths

Source§

fn default() -> Widths

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.