pub enum GenericParamDefKind {
Lifetime {
outlives: Vec<String>,
},
Type {
bounds: Vec<GenericBound>,
default: Option<Type>,
synthetic: bool,
},
Const {
type_: Type,
default: Option<String>,
},
}
Variants
Lifetime
Type
Fields
bounds: Vec<GenericBound>
synthetic: bool
This is normally false
, which means that this generic parameter is
declared in the Rust source text.
If it is true
, this generic parameter has been introduced by the
compiler behind the scenes.
Example
Consider
pub fn f(_: impl Trait) {}
The compiler will transform this behind the scenes to
pub fn f<impl Trait: Trait>(_: impl Trait) {}
In this example, the generic parameter named impl Trait
(and which
is bound by Trait
) is synthetic, because it was not originally in
the Rust source text.
Const
Trait Implementations
sourceimpl Clone for GenericParamDefKind
impl Clone for GenericParamDefKind
sourcefn clone(&self) -> GenericParamDefKind
fn clone(&self) -> GenericParamDefKind
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for GenericParamDefKind
impl Debug for GenericParamDefKind
sourceimpl<'de> Deserialize<'de> for GenericParamDefKind
impl<'de> Deserialize<'de> for GenericParamDefKind
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialEq<GenericParamDefKind> for GenericParamDefKind
impl PartialEq<GenericParamDefKind> for GenericParamDefKind
sourcefn eq(&self, other: &GenericParamDefKind) -> bool
fn eq(&self, other: &GenericParamDefKind) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &GenericParamDefKind) -> bool
fn ne(&self, other: &GenericParamDefKind) -> bool
This method tests for !=
.
sourceimpl Serialize for GenericParamDefKind
impl Serialize for GenericParamDefKind
impl StructuralPartialEq for GenericParamDefKind
Auto Trait Implementations
impl RefUnwindSafe for GenericParamDefKind
impl Send for GenericParamDefKind
impl Sync for GenericParamDefKind
impl Unpin for GenericParamDefKind
impl UnwindSafe for GenericParamDefKind
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more