pub struct BoundedGenericParams {
pub params: Vec<BoundedGenericParam>,
}Expand description
Stores different representations of generic parameters for implementing traits.
This structure separates generic parameters into different formats needed when generating trait implementations.
Fields§
§params: Vec<BoundedGenericParam>Collection of generic parameters with their bounds
Implementations§
Source§impl BoundedGenericParams
impl BoundedGenericParams
Sourcepub fn as_phantom_data(&self) -> AsPhantomData<'_>
pub fn as_phantom_data(&self) -> AsPhantomData<'_>
Returns a display wrapper that formats generic parameters as a PhantomData type
Source§impl BoundedGenericParams
impl BoundedGenericParams
Sourcepub fn display_with_bounds(&self) -> WithBounds<'_>
pub fn display_with_bounds(&self) -> WithBounds<'_>
Returns a display wrapper that formats generic parameters with their bounds
Sourcepub fn display_without_bounds(&self) -> WithoutBounds<'_>
pub fn display_without_bounds(&self) -> WithoutBounds<'_>
Returns a display wrapper that formats generic parameters without their bounds
Sourcepub fn display_as_phantom_data(&self) -> AsPhantomData<'_>
pub fn display_as_phantom_data(&self) -> AsPhantomData<'_>
Returns a display wrapper that formats generic parameters as a PhantomData
This is a convenience method for generating PhantomData expressions for use in trait implementations.
§Example
For generic parameters <'a, T, const N: usize>, this returns a wrapper that
when displayed produces:
::core::marker::PhantomData<(*mut &'a (), T, [u32; N])>
Sourcepub fn with(&self, param: BoundedGenericParam) -> BoundedGenericParams
pub fn with(&self, param: BoundedGenericParam) -> BoundedGenericParams
Adds a new generic parameter in the correct position (lifetimes, then types, then consts)
Sourcepub fn with_lifetime(&self, name: LifetimeName) -> BoundedGenericParams
pub fn with_lifetime(&self, name: LifetimeName) -> BoundedGenericParams
Adds a new lifetime parameter with the given name without bounds
This is a convenience method for adding a lifetime parameter that’s commonly used in trait implementations.
Sourcepub fn with_type(&self, name: TokenStream) -> BoundedGenericParams
pub fn with_type(&self, name: TokenStream) -> BoundedGenericParams
Adds a new type parameter with the given name without bounds
This is a convenience method for adding a type parameter that’s commonly used in trait implementations.
Source§impl BoundedGenericParams
impl BoundedGenericParams
Sourcepub fn parse(generics: Option<&GenericParams>) -> BoundedGenericParams
pub fn parse(generics: Option<&GenericParams>) -> BoundedGenericParams
Parses generic parameters into separate components for implementing traits.
This method takes a generic parameter declaration and populates the BoundedGenericParams struct with different representations of the generic parameters needed for code generation.
§Examples
For a type like struct Example<T: Clone, 'a, const N: usize>, this would populate:
params with entries for each parameter and their bounds.
Trait Implementations§
Source§impl Clone for BoundedGenericParams
impl Clone for BoundedGenericParams
Source§fn clone(&self) -> BoundedGenericParams
fn clone(&self) -> BoundedGenericParams
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for BoundedGenericParams
impl RefUnwindSafe for BoundedGenericParams
impl !Send for BoundedGenericParams
impl !Sync for BoundedGenericParams
impl Unpin for BoundedGenericParams
impl UnwindSafe for BoundedGenericParams
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)