pub struct Trait { /* private fields */ }
Expand description
Defines a trait.
Implementations§
Source§impl Trait
impl Trait
Sourcepub fn ty(&self) -> &Type
pub fn ty(&self) -> &Type
Returns a reference to the type.
§Examples
use rust_codegen::Trait;
let foo_trait = Trait::new("Foo");
println!("{:?}", foo_trait.ty());
Sourcepub fn generic(&mut self, name: &str) -> &mut Self
pub fn generic(&mut self, name: &str) -> &mut Self
Add a generic to the trait.
§Examples
use rust_codegen::Trait;
let mut foo_trait = Trait::new("Foo");
foo_trait.generic("T");
Sourcepub fn associated_type(&mut self, name: &str) -> &mut AssociatedType
pub fn associated_type(&mut self, name: &str) -> &mut AssociatedType
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Trait
impl RefUnwindSafe for Trait
impl Send for Trait
impl Sync for Trait
impl Unpin for Trait
impl UnwindSafe for Trait
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more