Skip to main content

Terms

Struct Terms 

Source
pub struct Terms<'a> { /* private fields */ }
Expand description

One instruction of a function, as the terms a rule could match.

Implementations§

Source§

impl<'a> Terms<'a>

Source

pub fn new(func: &'a Func, root: Inst, plan: Plan) -> Self

The instruction, shown the way the plan says.

Source

pub fn root(&self) -> Inst

The instruction this is about.

Source

pub fn name(&self, inst: Inst) -> Option<&'static str>

What the root, or an instruction one of its operands was expanded into, is called in a rule file.

Source

pub fn constant(&self, value: Value) -> Option<i128>

What a value is, if it is a constant.

Trait Implementations§

Source§

impl<'a> Debug for Terms<'a>

Source§

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

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

impl Subject for Terms<'_>

Source§

type Node = Term

What this subject calls one of its terms.
Source§

fn head(&self, node: Term) -> Option<(&str, usize)>

The head of a term and how many arguments it has, or nothing if the term is not an application. An IR instruction answers with its opcode and its width, spelled the way the rule file spells it.
Source§

fn arg(&self, node: Term, index: usize) -> Term

One argument of a term, counted from zero. Only ever asked for an argument the answer to Subject::head said was there.
Source§

fn int(&self, node: Term) -> Option<i128>

The value of a term that is a constant, or nothing if it is not one. This is what a pattern matching a literal is asking, and what a guard reads.

Auto Trait Implementations§

§

impl<'a> Freeze for Terms<'a>

§

impl<'a> RefUnwindSafe for Terms<'a>

§

impl<'a> Send for Terms<'a>

§

impl<'a> Sync for Terms<'a>

§

impl<'a> Unpin for Terms<'a>

§

impl<'a> UnsafeUnpin for Terms<'a>

§

impl<'a> UnwindSafe for Terms<'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> 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, 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.