Skip to main content

Attribute

Trait Attribute 

Source
pub trait Attribute:
    Printable
    + Verify
    + Downcast
    + Sync
    + Send
    + DynClone
    + Debug {
    // Required methods
    fn hash_attr(&self) -> TypeValueHash;
    fn eq_attr(&self, other: &(dyn Attribute + 'static)) -> bool;
    fn get_attr_id(&self) -> AttrId;
    fn get_attr_id_static() -> AttrId
       where Self: Sized;

    // Provided method
    fn register<A>(ctx: &mut Context)
       where A: Attribute,
             Self: Sized + Parsable<Arg = (), Parsed = A> { ... }
}
Expand description

Basic functionality that every attribute in the IR must implement.

See module documentation for more information.

Required Methods§

Source

fn hash_attr(&self) -> TypeValueHash

Compute and get the hash for this instance of Self. Hash collisions can be a possibility.

Source

fn eq_attr(&self, other: &(dyn Attribute + 'static)) -> bool

Is self equal to an other Attribute?

Source

fn get_attr_id(&self) -> AttrId

Get an Attribute’s static name. This is not per instantnce. It is mostly useful for printing and parsing the attribute.

Source

fn get_attr_id_static() -> AttrId
where Self: Sized,

Same as get_attr_id, but without the self reference.

Provided Methods§

Source

fn register<A>(ctx: &mut Context)
where A: Attribute, Self: Sized + Parsable<Arg = (), Parsed = A>,

Register this attribute’s AttrId in the dialect it belongs to.

Implementations§

Source§

impl dyn Attribute

Source

pub fn is<__T>(&self) -> bool
where __T: Attribute,

Returns true if the trait object wraps an object of type __T.

Source

pub fn downcast<__T>( self: Box<dyn Attribute>, ) -> Result<Box<__T>, Box<dyn Attribute>>
where __T: Attribute,

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn’t.

Source

pub fn downcast_rc<__T>( self: Rc<dyn Attribute>, ) -> Result<Rc<__T>, Rc<dyn Attribute>>
where __T: Attribute,

Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of type __T. Returns the original Rc-ed trait if it isn’t.

Source

pub fn downcast_ref<__T>(&self) -> Option<&__T>
where __T: Attribute,

Returns a reference to the object within the trait object if it is of type __T, or None if it isn’t.

Source

pub fn downcast_mut<__T>(&mut self) -> Option<&mut __T>
where __T: Attribute,

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn’t.

Trait Implementations§

Source§

impl<'clone> Clone for Box<dyn Attribute + 'clone>

Source§

fn clone(&self) -> Box<dyn Attribute + 'clone>

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<'clone> Clone for Box<dyn Attribute + Send + 'clone>

Source§

fn clone(&self) -> Box<dyn Attribute + Send + 'clone>

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<'clone> Clone for Box<dyn Attribute + Sync + 'clone>

Source§

fn clone(&self) -> Box<dyn Attribute + Sync + 'clone>

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<'clone> Clone for Box<dyn Attribute + Send + Sync + 'clone>

Source§

fn clone(&self) -> Box<dyn Attribute + Send + Sync + 'clone>

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 CloneIntoContext for Box<dyn Attribute>

Source§

fn clone_into_context( &self, src_ctx: &Context, dst_ctx: &mut Context, ) -> Box<dyn Attribute>

Clone self from src_ctx into dst_ctx.
Source§

impl Eq for Box<dyn Attribute>

Source§

impl<T> From<T> for Box<dyn Attribute>
where T: Attribute,

Source§

fn from(value: T) -> Box<dyn Attribute>

Converts to this type from the input type.
Source§

impl Hash for Box<dyn Attribute>

Source§

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

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 Parsable for Box<dyn Attribute>

Source§

type Arg = ()

Type of the argument that must be passed to the parser.
Source§

type Parsed = Box<dyn Attribute>

The type of the parsed entity.
Source§

fn parse<'a>( state_stream: &mut Stream<Stream<Stream<Stream<IteratorStream<CharIterator<'a>>, SourcePosition>>>, State<'a>>, _arg: <Box<dyn Attribute> as Parsable>::Arg, ) -> Result<(<Box<dyn Attribute> as Parsable>::Parsed, Commit<()>), Commit<Tracked<<Stream<Stream<Stream<Stream<IteratorStream<CharIterator<'a>>, SourcePosition>>>, State<'a>> as StreamOnce>::Error>>>

Define a parser using existing combinators and call into on Parser::parse_stream to get the final ParseResult. Use state_stream.state as necessary.
Source§

fn parser<'a>( arg: Self::Arg, ) -> Box<dyn Parser<Stream<Stream<Stream<Stream<IteratorStream<CharIterator<'a>>, SourcePosition>>>, State<'a>>, PartialState = (), Output = Self::Parsed> + 'a>
where Self::Parsed: 'a,

Get a parser combinator that can work on StateStream as its input.
Source§

impl PartialEq for Box<dyn Attribute>

Source§

fn eq(&self, other: &Box<dyn Attribute>) -> bool

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

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

Inequality operator !=. Read more
Source§

impl Printable for Box<dyn Attribute>

Source§

fn fmt( &self, ctx: &Context, state: &State, f: &mut Formatter<'_>, ) -> Result<(), Error>

Source§

fn disp<'t, 'c>(&'t self, ctx: &'c Context) -> Box<dyn Display + 'c>
where 't: 'c,

Get a Display’able object from the given Context and default State.
Source§

fn print<'t, 'c>( &'t self, ctx: &'c Context, state: &State, ) -> Box<dyn Display + 'c>
where 't: 'c,

Get a Display’able object from the given Context and State.
Source§

impl StableHash for Box<dyn Attribute>

Source§

fn stable_hash(&self, ctx: &Context, state: &mut dyn Hasher)

Compute a stable hash for self.
Source§

impl Verify for Box<dyn Attribute>

Source§

fn verify(&self, ctx: &Context) -> Result<(), Error>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Attribute for AddressSpaceAttr

Source§

impl Attribute for AddressSpaceVecAttr

Source§

impl Attribute for cubecl::ir::attributes::BoolAttr

Source§

impl Attribute for cubecl::ir::pliron::builtin::attributes::BoolAttr

Source§

impl Attribute for BufferBindingAttr

Source§

impl Attribute for BufferIOAttr

Source§

impl Attribute for BuiltinAttr

Source§

impl Attribute for ComplexAttr

Source§

impl Attribute for DictAttr

Source§

impl Attribute for Dim3Attr

Source§

impl Attribute for EntrypointAbiAttr

Source§

impl Attribute for FPBFloatAttr

Source§

impl Attribute for FPDoubleAttr

Source§

impl Attribute for FPHalfAttr

Source§

impl Attribute for FPSingleAttr

Source§

impl Attribute for FloatAttr

Source§

impl Attribute for GivenNamesAttr

Source§

impl Attribute for IdentifierAttr

Source§

impl Attribute for IndexAttr

Source§

impl Attribute for InputSpec

Source§

impl Attribute for InputSpecsAttr

Source§

impl Attribute for IntegerAttr

Source§

impl Attribute for IntegerVecAttr

Source§

impl Attribute for MatrixLayoutAttr

Source§

impl Attribute for MatrixShapeAttr

Source§

impl Attribute for MatrixTypeAttr

Source§

impl Attribute for MemoryClobbersAttr

Source§

impl Attribute for OperandSegmentSizesAttr

Source§

impl Attribute for RegSpec

Source§

impl Attribute for RegSpecsAttr

Source§

impl Attribute for StringAttr

Source§

impl Attribute for SymbolVisibilityAttr

Source§

impl Attribute for SyncScopeAttr

Source§

impl Attribute for TypeAttr

Source§

impl Attribute for UnitAttr

Source§

impl Attribute for VecAttr

Source§

impl Attribute for ZeroAttr