Skip to main content

TypeParam

Enum TypeParam 

Source
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>

Source

pub const fn is_type_var(&self) -> bool

Returns true if self is of variant TypeVar.

Source

pub fn as_type_var(&self) -> Option<&TypeParamTypeVar<R>>

Returns Some if self is a reference of variant TypeVar, and None otherwise.

Source

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.

Source

pub fn expect_type_var(self) -> TypeParamTypeVar<R>
where Self: Debug,

Unwraps the value, yielding the content of TypeVar.

§Panics

Panics if the value is not TypeVar. In debug builds the panic message includes the content of self.

Source

pub fn type_var(self) -> Option<TypeParamTypeVar<R>>

Returns Some if self is of variant TypeVar, and None otherwise.

Source

pub const fn is_param_spec(&self) -> bool

Returns true if self is of variant ParamSpec.

Source

pub fn as_param_spec(&self) -> Option<&TypeParamParamSpec<R>>

Returns Some if self is a reference of variant ParamSpec, and None otherwise.

Source

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.

Source

pub fn expect_param_spec(self) -> TypeParamParamSpec<R>
where Self: Debug,

Unwraps the value, yielding the content of ParamSpec.

§Panics

Panics if the value is not ParamSpec. In debug builds the panic message includes the content of self.

Source

pub fn param_spec(self) -> Option<TypeParamParamSpec<R>>

Returns Some if self is of variant ParamSpec, and None otherwise.

Source

pub const fn is_type_var_tuple(&self) -> bool

Returns true if self is of variant TypeVarTuple.

Source

pub fn as_type_var_tuple(&self) -> Option<&TypeParamTypeVarTuple<R>>

Returns Some if self is a reference of variant TypeVarTuple, and None otherwise.

Source

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.

Source

pub fn expect_type_var_tuple(self) -> TypeParamTypeVarTuple<R>
where Self: Debug,

Unwraps the value, yielding the content of TypeVarTuple.

§Panics

Panics if the value is not TypeVarTuple. In debug builds the panic message includes the content of self.

Source

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: Clone> Clone for TypeParam<R>

Source§

fn clone(&self) -> TypeParam<R>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<R: Debug> Debug for TypeParam<R>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T, U> Foldable<T, U> for TypeParam<T>

Source§

type Mapped = TypeParam<U>

Source§

fn fold<F: Fold<T, TargetU = U> + ?Sized>( self, folder: &mut F, ) -> Result<Self::Mapped, F::Error>

Source§

impl<R> From<TypeParam<R>> for Ast<R>

Source§

fn from(node: TypeParam<R>) -> Self

Converts to this type from the input type.
Source§

impl<R> From<TypeParamParamSpec<R>> for TypeParam<R>

Source§

fn from(payload: TypeParamParamSpec<R>) -> Self

Converts to this type from the input type.
Source§

impl<R> From<TypeParamTypeVar<R>> for TypeParam<R>

Source§

fn from(payload: TypeParamTypeVar<R>) -> Self

Converts to this type from the input type.
Source§

impl<R> From<TypeParamTypeVarTuple<R>> for TypeParam<R>

Source§

fn from(payload: TypeParamTypeVarTuple<R>) -> Self

Converts to this type from the input type.
Source§

impl<R> Node for TypeParam<R>

Source§

const NAME: &'static str = "type_param"

Source§

const FIELD_NAMES: &'static [&'static str]

Source§

impl<R: PartialEq> PartialEq for TypeParam<R>

Source§

fn eq(&self, other: &TypeParam<R>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
§

impl Ranged for TypeParam

§

fn range(&self) -> TextRange

Source§

fn start(&self) -> TextSize

Source§

fn end(&self) -> TextSize

Source§

impl<R: PartialEq> StructuralPartialEq for TypeParam<R>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T, U> ExactFrom<T> for U
where U: TryFrom<T>,

Source§

fn exact_from(value: T) -> U

Source§

impl<T, U> ExactInto<U> for T
where U: ExactFrom<T>,

Source§

fn exact_into(self) -> U

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> OverflowingInto<U> for T
where U: OverflowingFrom<T>,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> RoundingInto<U> for T
where U: RoundingFrom<T>,

Source§

impl<T, U> SaturatingInto<U> for T
where U: SaturatingFrom<T>,

Source§

impl<T> ToDebugString for T
where T: Debug,

Source§

fn to_debug_string(&self) -> String

Returns the String produced by Ts Debug implementation.

§Examples
use malachite_base::strings::ToDebugString;

assert_eq!([1, 2, 3].to_debug_string(), "[1, 2, 3]");
assert_eq!(
    [vec![2, 3], vec![], vec![4]].to_debug_string(),
    "[[2, 3], [], [4]]"
);
assert_eq!(Some(5).to_debug_string(), "Some(5)");
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U> WrappingInto<U> for T
where U: WrappingFrom<T>,

Source§

fn wrapping_into(self) -> U