pub struct Impl { /* private fields */ }
Expand description
Defines an impl block.
Implementations§
Source§impl 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 Self
pub fn target_generic<T>(&mut self, ty: T) -> &mut Self
Add a generic to the target type.
Sourcepub fn impl_trait<T>(&mut self, ty: T) -> &mut Self
pub fn impl_trait<T>(&mut self, ty: T) -> &mut Self
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 Self
pub fn associate_const<T>( &mut self, name: impl Into<String>, ty: T, value: impl Into<String>, visibility: impl Into<String>, ) -> &mut Self
Set an associated constant.
Sourcepub fn associate_type<T>(&mut self, name: &str, ty: T) -> &mut Self
pub fn associate_type<T>(&mut self, name: &str, ty: T) -> &mut Self
Set an associated type.
Sourcepub fn bound<T>(&mut self, name: &str, ty: T) -> &mut Self
pub fn bound<T>(&mut self, name: &str, ty: T) -> &mut Self
Add a where
bound to the impl block.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Impl
impl RefUnwindSafe for Impl
impl Send for Impl
impl Sync for Impl
impl Unpin for Impl
impl UnwindSafe for Impl
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