pub enum Pat {
Ident(String),
Object(Vec<PatField>),
Array(Vec<Option<Pat>>, Option<String>),
Rest(Box<Pat>),
}Expand description
A binding pattern.
Patterns appear on the left-hand side of destructuring declarations and in destructuring function parameters.
Variants§
Ident(String)
Simple identifier binding: x.
Object(Vec<PatField>)
Object destructuring pattern: { x, y: z, ...rest }.
Array(Vec<Option<Pat>>, Option<String>)
Array/tuple destructuring pattern: [x, y, ...rest].
Elements are None for holes (e.g. [, y] skips the first element).
rest is the name of the rest element (e.g. "rest" for [...rest]).
Rest(Box<Pat>)
Rest pattern: ...rest (used inside object/array patterns).
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Pat
impl<'de> Deserialize<'de> for Pat
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl StructureEq for Pat
impl StructureEq for Pat
Source§fn structure_eq(&self, other: &Self) -> bool
fn structure_eq(&self, other: &Self) -> bool
Compare two values for structural equality.
impl StructuralPartialEq for Pat
Auto Trait Implementations§
impl Freeze for Pat
impl RefUnwindSafe for Pat
impl Send for Pat
impl Sync for Pat
impl Unpin for Pat
impl UnsafeUnpin for Pat
impl UnwindSafe for Pat
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request