pub struct PureClosureParam {
pub pattern: PurePattern,
pub ty: Option<PureType>,
}Expand description
Closure parameter with optional type annotation.
Unlike function parameters (PureParam), closure parameters:
- Use patterns (destructuring, wildcards, etc.) not just names
- Type annotations are optional (often inferred)
§Examples
|x|→PureClosureParam { pattern: Ident("x"), ty: None }|x: Foo|→PureClosureParam { pattern: Ident("x"), ty: Some(Path("Foo")) }|(a, b): (Foo, Bar)|→PureClosureParam { pattern: Tuple(..), ty: Some(Tuple(..)) }
Fields§
§pattern: PurePatternThe parameter pattern.
ty: Option<PureType>Optional type annotation.
Implementations§
Source§impl PureClosureParam
impl PureClosureParam
Sourcepub fn untyped(pattern: PurePattern) -> Self
pub fn untyped(pattern: PurePattern) -> Self
Create an untyped closure parameter (type will be inferred).
Sourcepub fn typed(pattern: PurePattern, ty: PureType) -> Self
pub fn typed(pattern: PurePattern, ty: PureType) -> Self
Create a typed closure parameter.
Trait Implementations§
Source§impl Clone for PureClosureParam
impl Clone for PureClosureParam
Source§fn clone(&self) -> PureClosureParam
fn clone(&self) -> PureClosureParam
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 PureClosureParam
impl Debug for PureClosureParam
Source§impl PartialEq for PureClosureParam
impl PartialEq for PureClosureParam
Source§fn eq(&self, other: &PureClosureParam) -> bool
fn eq(&self, other: &PureClosureParam) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for PureClosureParam
impl StructuralPartialEq for PureClosureParam
Auto Trait Implementations§
impl Freeze for PureClosureParam
impl RefUnwindSafe for PureClosureParam
impl Send for PureClosureParam
impl Sync for PureClosureParam
impl Unpin for PureClosureParam
impl UnsafeUnpin for PureClosureParam
impl UnwindSafe for PureClosureParam
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