pub struct SwitchOp<'a> { /* private fields */ }Expand description
A switch statement.
Implementations§
Source§impl<'a> SwitchOp<'a>
impl<'a> SwitchOp<'a>
Sourcepub fn branches(&self) -> impl Iterator<Item = Region<'a>>
pub fn branches(&self) -> impl Iterator<Item = Region<'a>>
Returns an iterator over the branches of this switch statement.
Sourcepub fn branch_count(&self) -> usize
pub fn branch_count(&self) -> usize
Returns the number of branches in this switch statement.
Sourcepub fn branch(&self, n: usize) -> Region<'a>
pub fn branch(&self, n: usize) -> Region<'a>
Returns the n-th branch of this switch statement.
§Panics
Panics if n is equal or greater than SwitchOp::branch_count.
Sourcepub fn try_branch(&self, n: usize) -> Option<Region<'a>>
pub fn try_branch(&self, n: usize) -> Option<Region<'a>>
Returns the n-th branch of this switch statement.
Returns None if n is equal or greater than SwitchOp::branch_count.
Sourcepub fn default_branch(&self) -> Option<Region<'_>>
pub fn default_branch(&self) -> Option<Region<'_>>
Returns the default branch of this switch statement.
Returns None if there is no default branch.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for SwitchOp<'a>
impl<'a> !Send for SwitchOp<'a>
impl<'a> !Sync for SwitchOp<'a>
impl<'a> !UnwindSafe for SwitchOp<'a>
impl<'a> Freeze for SwitchOp<'a>
impl<'a> Unpin for SwitchOp<'a>
impl<'a> UnsafeUnpin for SwitchOp<'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