pub struct GenericParameters { /* private fields */ }
Expand description
Represents generic parameters in a function or type declaration.
Generic parameters allow type signatures to be parameterized,
written as <T, U...>
in Luau type annotations.
Implementations§
Source§impl GenericParameters
impl GenericParameters
Sourcepub fn from_type_variable(name: impl Into<Identifier>) -> Self
pub fn from_type_variable(name: impl Into<Identifier>) -> Self
Creates new generic parameters with a single type variable.
Sourcepub fn from_generic_type_pack(
generic_type_pack: impl Into<GenericTypePack>,
) -> Self
pub fn from_generic_type_pack( generic_type_pack: impl Into<GenericTypePack>, ) -> Self
Creates new generic parameters with a single generic type pack.
Sourcepub fn with_type_variable(self, type_variable: impl Into<Identifier>) -> Self
pub fn with_type_variable(self, type_variable: impl Into<Identifier>) -> Self
Adds a type variable to these generic parameters.
Sourcepub fn push_type_variable(&mut self, type_variable: impl Into<Identifier>)
pub fn push_type_variable(&mut self, type_variable: impl Into<Identifier>)
Adds a type variable to these generic parameters.
Sourcepub fn push_generic_type_pack(&mut self, generic_pack: GenericTypePack)
pub fn push_generic_type_pack(&mut self, generic_pack: GenericTypePack)
Adds a generic type pack to these generic parameters.
Sourcepub fn type_variables_len(&self) -> usize
pub fn type_variables_len(&self) -> usize
Returns the number of type variables in these generic parameters.
Sourcepub fn generic_type_packs_len(&self) -> usize
pub fn generic_type_packs_len(&self) -> usize
Returns the number of generic type packs in these generic parameters.
Sourcepub fn iter_type_variable(&self) -> impl Iterator<Item = &Identifier>
pub fn iter_type_variable(&self) -> impl Iterator<Item = &Identifier>
Returns an iterator over the type variables in these generic parameters.
Sourcepub fn iter_mut_type_variable(
&mut self,
) -> impl Iterator<Item = &mut Identifier>
pub fn iter_mut_type_variable( &mut self, ) -> impl Iterator<Item = &mut Identifier>
Returns a mutable iterator over the type variables in these generic parameters.
Sourcepub fn iter_generic_type_pack(&self) -> impl Iterator<Item = &GenericTypePack>
pub fn iter_generic_type_pack(&self) -> impl Iterator<Item = &GenericTypePack>
Returns an iterator over the generic type packs in these generic parameters.
Sourcepub fn iter_mut_generic_type_pack(
&mut self,
) -> impl Iterator<Item = &mut GenericTypePack>
pub fn iter_mut_generic_type_pack( &mut self, ) -> impl Iterator<Item = &mut GenericTypePack>
Returns a mutable iterator over the generic type packs in these generic parameters.
Sourcepub fn with_tokens(self, tokens: GenericParametersTokens) -> Self
pub fn with_tokens(self, tokens: GenericParametersTokens) -> Self
Associates tokens with these generic parameters.
Sourcepub fn set_tokens(&mut self, tokens: GenericParametersTokens)
pub fn set_tokens(&mut self, tokens: GenericParametersTokens)
Sets the tokens associated with these generic parameters.
Sourcepub fn get_tokens(&self) -> Option<&GenericParametersTokens>
pub fn get_tokens(&self) -> Option<&GenericParametersTokens>
Returns the tokens associated with these generic parameters, if any.
Sourcepub fn clear_comments(&mut self)
pub fn clear_comments(&mut self)
Clears all comments from the tokens in this node.
Sourcepub fn clear_whitespaces(&mut self)
pub fn clear_whitespaces(&mut self)
Clears all whitespaces information from the tokens in this node.
Trait Implementations§
Source§impl Clone for GenericParameters
impl Clone for GenericParameters
Source§fn clone(&self) -> GenericParameters
fn clone(&self) -> GenericParameters
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for GenericParameters
impl Debug for GenericParameters
Source§impl PartialEq for GenericParameters
impl PartialEq for GenericParameters
impl Eq for GenericParameters
impl StructuralPartialEq for GenericParameters
Auto Trait Implementations§
impl Freeze for GenericParameters
impl RefUnwindSafe for GenericParameters
impl Send for GenericParameters
impl Sync for GenericParameters
impl Unpin for GenericParameters
impl UnwindSafe for GenericParameters
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
Source§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
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