pub struct ParameterWithDefault {
pub range: TextRange,
pub node_index: AtomicNodeIndex,
pub parameter: Parameter,
pub default: Option<Box<Expr>>,
}Expand description
An alternative type of AST arg. This is used for each function argument that might have a default value.
Used by Arguments original type.
NOTE: This type is different from original Python AST.
Fields§
§range: TextRange§node_index: AtomicNodeIndex§parameter: Parameter§default: Option<Box<Expr>>Implementations§
Source§impl ParameterWithDefault
impl ParameterWithDefault
pub fn default(&self) -> Option<&Expr>
pub const fn name(&self) -> &Identifier
pub fn annotation(&self) -> Option<&Expr>
Sourcepub fn uses_pep_484_positional_only_convention(&self) -> bool
pub fn uses_pep_484_positional_only_convention(&self) -> bool
Return true if the parameter name uses the pre-PEP-570 convention
(specified in PEP 484) to indicate to a type checker that it should be treated
as positional-only.
Trait Implementations§
Source§impl Clone for ParameterWithDefault
impl Clone for ParameterWithDefault
Source§fn clone(&self) -> ParameterWithDefault
fn clone(&self) -> ParameterWithDefault
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 Debug for ParameterWithDefault
impl Debug for ParameterWithDefault
Source§impl<'a> From<&'a ParameterWithDefault> for AnyNodeRef<'a>
impl<'a> From<&'a ParameterWithDefault> for AnyNodeRef<'a>
Source§fn from(node: &'a ParameterWithDefault) -> AnyNodeRef<'a>
fn from(node: &'a ParameterWithDefault) -> AnyNodeRef<'a>
Converts to this type from the input type.
Source§impl<'a> From<&'a ParameterWithDefault> for AnyRootNodeRef<'a>
impl<'a> From<&'a ParameterWithDefault> for AnyRootNodeRef<'a>
Source§fn from(node: &'a ParameterWithDefault) -> AnyRootNodeRef<'a>
fn from(node: &'a ParameterWithDefault) -> AnyRootNodeRef<'a>
Converts to this type from the input type.
Source§impl<'a> From<&'a ParameterWithDefault> for ComparableParameterWithDefault<'a>
impl<'a> From<&'a ParameterWithDefault> for ComparableParameterWithDefault<'a>
Source§fn from(arg: &'a ParameterWithDefault) -> Self
fn from(arg: &'a ParameterWithDefault) -> Self
Converts to this type from the input type.
Source§impl HasNodeIndex for ParameterWithDefault
impl HasNodeIndex for ParameterWithDefault
Source§fn node_index(&self) -> &AtomicNodeIndex
fn node_index(&self) -> &AtomicNodeIndex
Returns the
AtomicNodeIndex for this node.Source§impl Identifier for ParameterWithDefault
impl Identifier for ParameterWithDefault
Source§fn identifier(&self) -> TextRange
fn identifier(&self) -> TextRange
Return the TextRange for the identifier defining an ParameterWithDefault.
For example, return the range of x in:
def f(x: int = 0):
...Source§impl PartialEq for ParameterWithDefault
impl PartialEq for ParameterWithDefault
Source§impl Ranged for ParameterWithDefault
impl Ranged for ParameterWithDefault
Source§impl<'a> TryFrom<AnyRootNodeRef<'a>> for &'a ParameterWithDefault
impl<'a> TryFrom<AnyRootNodeRef<'a>> for &'a ParameterWithDefault
impl StructuralPartialEq for ParameterWithDefault
Auto Trait Implementations§
impl !Freeze for ParameterWithDefault
impl RefUnwindSafe for ParameterWithDefault
impl Send for ParameterWithDefault
impl Sync for ParameterWithDefault
impl Unpin for ParameterWithDefault
impl UnsafeUnpin for ParameterWithDefault
impl UnwindSafe for ParameterWithDefault
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