pub struct TraitImpl {
pub trait_path: String,
pub generics: Vec<GenericParam>,
pub is_unsafe: bool,
pub source: Option<String>,
/* private fields */
}Expand description
A trait implementation block.
Fieldsยง
ยงtrait_path: Stringยงgenerics: Vec<GenericParam>ยงis_unsafe: boolยงsource: Option<String>Implementationsยง
Sourceยงimpl TraitImpl
impl TraitImpl
Sourcepub fn trait_def(&self) -> Result<TraitDef>
pub fn trait_def(&self) -> Result<TraitDef>
Navigate to the trait definition being implemented.
Returns the TraitDef for the trait that this impl block implements.
ยงExample
โ
let user = krate.get_struct("User")?;
for impl_block in user.trait_impls()? {
let trait_def = impl_block.trait_def()?;
println!("Implements trait: {}", trait_def.name);
println!("Trait has {} methods", trait_def.methods().len());
}Sourcepub fn associated_types(&self) -> &[AssocTypeInfo]
pub fn associated_types(&self) -> &[AssocTypeInfo]
Get associated types in this impl.
Sourcepub fn associated_consts(&self) -> &[AssocConstInfo]
pub fn associated_consts(&self) -> &[AssocConstInfo]
Get associated constants in this impl.
Trait Implementationsยง
Auto Trait Implementationsยง
impl Freeze for TraitImpl
impl RefUnwindSafe for TraitImpl
impl Send for TraitImpl
impl Sync for TraitImpl
impl Unpin for TraitImpl
impl UnwindSafe for TraitImpl
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