Skip to main content

Lowering

Enum Lowering 

Source
#[non_exhaustive]
pub enum Lowering { Lsb(LsbOp), Host { module: String, name: String, }, Fast { fast: Fast, module: String, name: String, }, Class { op: ClassOp, module: String, name: String, }, }
Expand description

How one named intrinsic compiles.

§Examples

use bcgen_lang::{Fast, Lowering};

let l = Lowering::Fast { fast: Fast::Concat, module: "mox".into(), name: "concat".into() };
assert_eq!(l.host(), Some(("mox", "concat")));

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Lsb(LsbOp)

An LSB sequence, with LSB’s semantics (hooks included).

§

Host

A call to the host function module.name (an LSB import taking the operands as dyn and returning a dyn), always.

Fields

§module: String

The import module.

§name: String

The function name.

§

Fast

The fast path inline on its domain, the host function module.name everywhere else.

Fields

§fast: Fast

The guarded fast path.

§module: String

The import module of the slow path.

§name: String

The function name of the slow path.

§

Class

A class operation, inline for the unit’s classes, the host function module.name for everything else. A call of the extern path of the same name compiles the same way (lowering templates call host symbols, not intrinsics).

Fields

§op: ClassOp

The operation.

§module: String

The import module of the fallback.

§name: String

The function name of the fallback.

Implementations§

Source§

impl Lowering

Source

pub fn host(&self) -> Option<(&str, &str)>

The host function this lowering may call, as (module, name).

§Examples
use bcgen_lang::{Lowering, LsbOp};

assert_eq!(Lowering::Lsb(LsbOp::Len).host(), None);

Trait Implementations§

Source§

impl Clone for Lowering

Source§

fn clone(&self) -> Self

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 Lowering

Source§

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

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

impl Eq for Lowering

Source§

impl Hash for Lowering

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Lowering

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Lowering

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.