#[non_exhaustive]pub struct SwitchStmt {
pub expr: Expr,
pub body: SwitchBody,
pub uses_alternative: bool,
}Expand description
A switch statement.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.expr: ExprThe switched-on expression.
body: SwitchBodyThe braced case list.
uses_alternative: boolWhether the switch: ... endswitch; syntax is used.
Implementations§
Source§impl SwitchStmt
impl SwitchStmt
Sourcepub fn new(expr: Expr, body: SwitchBody) -> Self
pub fn new(expr: Expr, body: SwitchBody) -> Self
Builds a SwitchStmt from its identifying fields with every other field empty. Set
the rest by assignment, as with Param::new.
Trait Implementations§
Source§impl Clone for SwitchStmt
impl Clone for SwitchStmt
Source§impl Debug for SwitchStmt
impl Debug for SwitchStmt
Auto Trait Implementations§
impl Freeze for SwitchStmt
impl RefUnwindSafe for SwitchStmt
impl Send for SwitchStmt
impl Sync for SwitchStmt
impl Unpin for SwitchStmt
impl UnsafeUnpin for SwitchStmt
impl UnwindSafe for SwitchStmt
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