pub enum AnyParameterRef<'a> {
Variadic(&'a Parameter),
NonVariadic(&'a ParameterWithDefault),
}Expand description
Enumeration of the two kinds of parameter
Variants§
Variadic(&'a Parameter)
Variadic parameters cannot have default values,
e.g. both *args and **kwargs in the following function:
def foo(*args, **kwargs): passNonVariadic(&'a ParameterWithDefault)
Non-variadic parameters can have default values, though they won’t necessarily always have them:
def bar(a=1, /, b=2, *, c=3): passImplementations§
Source§impl<'a> AnyParameterRef<'a>
impl<'a> AnyParameterRef<'a>
pub const fn as_parameter(self) -> &'a Parameter
pub const fn name(self) -> &'a Identifier
pub const fn is_variadic(self) -> bool
pub fn annotation(self) -> Option<&'a Expr>
pub fn default(self) -> Option<&'a Expr>
Trait Implementations§
Source§impl<'a> Clone for AnyParameterRef<'a>
impl<'a> Clone for AnyParameterRef<'a>
Source§fn clone(&self) -> AnyParameterRef<'a>
fn clone(&self) -> AnyParameterRef<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for AnyParameterRef<'a>
impl<'a> Debug for AnyParameterRef<'a>
Source§impl<'a> PartialEq for AnyParameterRef<'a>
impl<'a> PartialEq for AnyParameterRef<'a>
Source§impl Ranged for AnyParameterRef<'_>
impl Ranged for AnyParameterRef<'_>
impl<'a> Copy for AnyParameterRef<'a>
impl<'a> StructuralPartialEq for AnyParameterRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for AnyParameterRef<'a>
impl<'a> RefUnwindSafe for AnyParameterRef<'a>
impl<'a> Send for AnyParameterRef<'a>
impl<'a> Sync for AnyParameterRef<'a>
impl<'a> Unpin for AnyParameterRef<'a>
impl<'a> UnsafeUnpin for AnyParameterRef<'a>
impl<'a> UnwindSafe for AnyParameterRef<'a>
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
Mutably borrows from an owned value. Read more
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>
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 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>
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