pub trait AttachGenericsWithAssert<'a, A> {
type Output;
// Required method
fn with_optional_generics<B>(
self,
generics: Option<impl Into<MaybeBorrowed<'a, Generics>>>,
) -> WithGenerics<'a, Self::Output>
where B: TypeEq<This = A>;
// Provided method
fn with_generics<B>(
self,
generics: impl Into<MaybeBorrowed<'a, Generics>>,
) -> WithGenerics<'a, Self::Output>
where B: TypeEq<This = A>,
Self: Sized { ... }
}
Expand description
A trait meant to be implemented for all types that may want some generics to be attached to them.
Required Associated Types§
Sourcetype Output
type Output
An optional type wrapper around the type the generics will be attached to
Used by this crate to wrap types with MaybeBorrowed
to allow both
references and owned types to be represented by the same type.
Required Methods§
fn with_optional_generics<B>(
self,
generics: Option<impl Into<MaybeBorrowed<'a, Generics>>>,
) -> WithGenerics<'a, Self::Output>where
B: TypeEq<This = A>,
Provided Methods§
Sourcefn with_generics<B>(
self,
generics: impl Into<MaybeBorrowed<'a, Generics>>,
) -> WithGenerics<'a, Self::Output>
fn with_generics<B>( self, generics: impl Into<MaybeBorrowed<'a, Generics>>, ) -> WithGenerics<'a, Self::Output>
Attach some generics G
to Self
. This allows for the generics to
to not exactly be syn::Generics
but any type that can be
turned into MaybeBorrowed<syn::Generics>
. This allows for
both &syn::Generics
and syn::Generics
to be attached using the
same trait.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.