[][src]Trait moore_vhdl::konst2::Const2

pub trait Const2<'t>: Debug + Display {
    fn ty(&self) -> &'t dyn Type;
fn into_owned(self) -> OwnedConst<'t>;
fn to_owned(&self) -> OwnedConst<'t>;
fn as_any<'r>(&'r self) -> AnyConst<'r, 't>;
fn cast(
        &self,
        ty: &'t dyn Type
    ) -> Result<Cow<'_, dyn Const2<'t> + 't>, ConstError>; }

An interface for dealing with constants.

This is the main trait which all constant values implement. Its purpose is to provide a convenient interface for inspecting and manipulating values. Dedicated structs for the specific types (e.g. integers, arrays, etc.) are expected to be allocated/internalized into an arena for ease of use.

Required methods

fn ty(&self) -> &'t dyn Type

Return the type of the constant.

fn into_owned(self) -> OwnedConst<'t>

Convert into an owned constant.

fn to_owned(&self) -> OwnedConst<'t>

Clone this constant.

fn as_any<'r>(&'r self) -> AnyConst<'r, 't>

Converts from &Const2 to AnyConst.

fn cast(
    &self,
    ty: &'t dyn Type
) -> Result<Cow<'_, dyn Const2<'t> + 't>, ConstError>

Cast the constant to a different type.

Loading content...

Trait Implementations

impl<'t> AllocOwned<'t, 't, dyn Const2<'t> + 't> for ConstArena<'t>[src]

impl<'t> Borrow<dyn Const2<'t> + 't> for OwnedConst<'t>[src]

impl<'t> ToOwned for dyn Const2<'t> + 't[src]

type Owned = OwnedConst<'t>

The resulting type after obtaining ownership.

Implementors

impl<'t> Const2<'t> for FloatingConst<'t>[src]

impl<'t> Const2<'t> for IntegerConst<'t>[src]

Loading content...