pub struct Impl { /* private fields */ }
Expand description
Defines an impl block.
Implementations
sourceimpl Impl
impl Impl
sourcepub fn generic(&mut self, name: &str) -> &mut Self
pub fn generic(&mut self, name: &str) -> &mut Self
Add a generic to the impl block.
This adds the generic for the block (impl<T>
) and not the target type.
sourcepub fn target_generic<T>(&mut self, ty: T) -> &mut Selfwhere
T: Into<Type>,
pub fn target_generic<T>(&mut self, ty: T) -> &mut Selfwhere
T: Into<Type>,
Add a generic to the target type.
sourcepub fn impl_trait<T>(&mut self, ty: T) -> &mut Selfwhere
T: Into<Type>,
pub fn impl_trait<T>(&mut self, ty: T) -> &mut Selfwhere
T: Into<Type>,
Set the trait that the impl block is implementing.
sourcepub fn macro(&mut self, macro: &str) -> &mut Self
pub fn macro(&mut self, macro: &str) -> &mut Self
Add a macro to the impl block (e.g. "#[async_trait]"
)
sourcepub fn associate_const<T>(
&mut self,
name: impl Into<String>,
ty: T,
value: impl Into<String>,
visibility: impl Into<String>
) -> &mut Selfwhere
T: Into<Type>,
pub fn associate_const<T>(
&mut self,
name: impl Into<String>,
ty: T,
value: impl Into<String>,
visibility: impl Into<String>
) -> &mut Selfwhere
T: Into<Type>,
Set an associated constant.
sourcepub fn associate_type<T>(&mut self, name: &str, ty: T) -> &mut Selfwhere
T: Into<Type>,
pub fn associate_type<T>(&mut self, name: &str, ty: T) -> &mut Selfwhere
T: Into<Type>,
Set an associated type.
sourcepub fn bound<T>(&mut self, name: &str, ty: T) -> &mut Selfwhere
T: Into<Type>,
pub fn bound<T>(&mut self, name: &str, ty: T) -> &mut Selfwhere
T: Into<Type>,
Add a where
bound to the impl block.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Impl
impl Send for Impl
impl Sync for Impl
impl Unpin for Impl
impl UnwindSafe for Impl
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more