Skip to main content
Version: dev

TraitDefinition

std::meta::trait_def contains methods on the built-in TraitDefinition type. This type represents trait definitions such as trait Foo { .. } at the top-level of a program.

Methods

as_trait_constraint

as_trait_constraint
pub comptime fn as_trait_constraint(_self: Self) -> TraitConstraint {}

Source code: noir_stdlib/src/meta/trait_def.nr#L6-L8

Converts this trait into a trait constraint. If there are any generics on this trait, they will be kept as-is without instantiating or replacing them.

location

location
pub comptime fn location(self) -> Location {}

Source code: noir_stdlib/src/meta/trait_def.nr#L11-L13

Returns the source Location where this trait is defined. This can be passed to std::meta::error or std::meta::warn to attach a diagnostic to the trait.

Trait Implementations

impl Eq for TraitDefinition
impl Hash for TraitDefinition