pub enum TypeParam<R = TextRange> {
TypeVar(TypeParamTypeVar<R>),
ParamSpec(TypeParamParamSpec<R>),
TypeVarTuple(TypeParamTypeVarTuple<R>),
}
Expand description
See also type_param
Variants§
TypeVar(TypeParamTypeVar<R>)
ParamSpec(TypeParamParamSpec<R>)
TypeVarTuple(TypeParamTypeVarTuple<R>)
Implementations§
Source§impl<R> TypeParam<R>
impl<R> TypeParam<R>
Sourcepub const fn is_type_var(&self) -> bool
pub const fn is_type_var(&self) -> bool
Returns true
if self
is of variant TypeVar
.
Sourcepub fn as_type_var(&self) -> Option<&TypeParamTypeVar<R>>
pub fn as_type_var(&self) -> Option<&TypeParamTypeVar<R>>
Returns Some
if self
is a reference of variant TypeVar
, and None
otherwise.
Sourcepub fn as_mut_type_var(&mut self) -> Option<&mut TypeParamTypeVar<R>>
pub fn as_mut_type_var(&mut self) -> Option<&mut TypeParamTypeVar<R>>
Returns Some
if self
is a mutable reference of variant TypeVar
, and None
otherwise.
Sourcepub fn expect_type_var(self) -> TypeParamTypeVar<R>
pub fn expect_type_var(self) -> TypeParamTypeVar<R>
Sourcepub fn type_var(self) -> Option<TypeParamTypeVar<R>>
pub fn type_var(self) -> Option<TypeParamTypeVar<R>>
Returns Some
if self
is of variant TypeVar
, and None
otherwise.
Sourcepub const fn is_param_spec(&self) -> bool
pub const fn is_param_spec(&self) -> bool
Returns true
if self
is of variant ParamSpec
.
Sourcepub fn as_param_spec(&self) -> Option<&TypeParamParamSpec<R>>
pub fn as_param_spec(&self) -> Option<&TypeParamParamSpec<R>>
Returns Some
if self
is a reference of variant ParamSpec
, and None
otherwise.
Sourcepub fn as_mut_param_spec(&mut self) -> Option<&mut TypeParamParamSpec<R>>
pub fn as_mut_param_spec(&mut self) -> Option<&mut TypeParamParamSpec<R>>
Returns Some
if self
is a mutable reference of variant ParamSpec
, and None
otherwise.
Sourcepub fn expect_param_spec(self) -> TypeParamParamSpec<R>
pub fn expect_param_spec(self) -> TypeParamParamSpec<R>
Sourcepub fn param_spec(self) -> Option<TypeParamParamSpec<R>>
pub fn param_spec(self) -> Option<TypeParamParamSpec<R>>
Returns Some
if self
is of variant ParamSpec
, and None
otherwise.
Sourcepub const fn is_type_var_tuple(&self) -> bool
pub const fn is_type_var_tuple(&self) -> bool
Returns true
if self
is of variant TypeVarTuple
.
Sourcepub fn as_type_var_tuple(&self) -> Option<&TypeParamTypeVarTuple<R>>
pub fn as_type_var_tuple(&self) -> Option<&TypeParamTypeVarTuple<R>>
Returns Some
if self
is a reference of variant TypeVarTuple
, and None
otherwise.
Sourcepub fn as_mut_type_var_tuple(&mut self) -> Option<&mut TypeParamTypeVarTuple<R>>
pub fn as_mut_type_var_tuple(&mut self) -> Option<&mut TypeParamTypeVarTuple<R>>
Returns Some
if self
is a mutable reference of variant TypeVarTuple
, and None
otherwise.
Sourcepub fn expect_type_var_tuple(self) -> TypeParamTypeVarTuple<R>
pub fn expect_type_var_tuple(self) -> TypeParamTypeVarTuple<R>
Unwraps the value, yielding the content of TypeVarTuple
.
§Panics
Panics if the value is not TypeVarTuple
, with a panic message including the content of self
.
Sourcepub fn type_var_tuple(self) -> Option<TypeParamTypeVarTuple<R>>
pub fn type_var_tuple(self) -> Option<TypeParamTypeVarTuple<R>>
Returns Some
if self
is of variant TypeVarTuple
, and None
otherwise.
Trait Implementations§
Source§impl<R> From<TypeParamParamSpec<R>> for TypeParam<R>
impl<R> From<TypeParamParamSpec<R>> for TypeParam<R>
Source§fn from(payload: TypeParamParamSpec<R>) -> TypeParam<R>
fn from(payload: TypeParamParamSpec<R>) -> TypeParam<R>
Source§impl<R> From<TypeParamTypeVar<R>> for TypeParam<R>
impl<R> From<TypeParamTypeVar<R>> for TypeParam<R>
Source§fn from(payload: TypeParamTypeVar<R>) -> TypeParam<R>
fn from(payload: TypeParamTypeVar<R>) -> TypeParam<R>
Source§impl<R> From<TypeParamTypeVarTuple<R>> for TypeParam<R>
impl<R> From<TypeParamTypeVarTuple<R>> for TypeParam<R>
Source§fn from(payload: TypeParamTypeVarTuple<R>) -> TypeParam<R>
fn from(payload: TypeParamTypeVarTuple<R>) -> TypeParam<R>
Source§impl Located for TypeParam<SourceRange>
impl Located for TypeParam<SourceRange>
fn range(&self) -> SourceRange
fn location(&self) -> SourceLocation
fn end_location(&self) -> Option<SourceLocation>
Source§impl LocatedMut for TypeParam<SourceRange>
impl LocatedMut for TypeParam<SourceRange>
fn range_mut(&mut self) -> &mut SourceRange
impl<R> StructuralPartialEq for TypeParam<R>
Auto Trait Implementations§
impl<R> Freeze for TypeParam<R>where
R: Freeze,
impl<R> RefUnwindSafe for TypeParam<R>where
R: RefUnwindSafe,
impl<R> Send for TypeParam<R>where
R: Send,
impl<R> Sync for TypeParam<R>where
R: Sync,
impl<R> Unpin for TypeParam<R>where
R: Unpin,
impl<R> UnwindSafe for TypeParam<R>where
R: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more