Struct stable_mir::mir::body::SwitchTargets
source · pub struct SwitchTargets {
branches: Vec<(u128, BasicBlockIdx)>,
otherwise: BasicBlockIdx,
}
Expand description
The possible branch sites of a TerminatorKind::SwitchInt.
Fields§
§branches: Vec<(u128, BasicBlockIdx)>
The conditional branches where the first element represents the value that guards this branch, and the second element is the branch target.
otherwise: BasicBlockIdx
The otherwise
branch which will be taken in case none of the conditional branches are
satisfied.
Implementations§
source§impl SwitchTargets
impl SwitchTargets
sourcepub fn all_targets(&self) -> Successors
pub fn all_targets(&self) -> Successors
All possible targets including the otherwise
target.
sourcepub fn otherwise(&self) -> BasicBlockIdx
pub fn otherwise(&self) -> BasicBlockIdx
The otherwise
branch target.
sourcepub fn branches(&self) -> impl Iterator<Item = (u128, BasicBlockIdx)> + '_
pub fn branches(&self) -> impl Iterator<Item = (u128, BasicBlockIdx)> + '_
The conditional targets which are only taken if the pattern matches the given value.
sourcepub fn new(
branches: Vec<(u128, BasicBlockIdx)>,
otherwise: BasicBlockIdx,
) -> SwitchTargets
pub fn new( branches: Vec<(u128, BasicBlockIdx)>, otherwise: BasicBlockIdx, ) -> SwitchTargets
Create a new SwitchTargets from the given branches and otherwise
target.
Trait Implementations§
source§impl Clone for SwitchTargets
impl Clone for SwitchTargets
source§fn clone(&self) -> SwitchTargets
fn clone(&self) -> SwitchTargets
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SwitchTargets
impl Debug for SwitchTargets
source§impl PartialEq for SwitchTargets
impl PartialEq for SwitchTargets
source§impl Serialize for SwitchTargets
impl Serialize for SwitchTargets
impl Eq for SwitchTargets
impl StructuralPartialEq for SwitchTargets
Auto Trait Implementations§
impl Freeze for SwitchTargets
impl RefUnwindSafe for SwitchTargets
impl Send for SwitchTargets
impl Sync for SwitchTargets
impl Unpin for SwitchTargets
impl UnwindSafe for SwitchTargets
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 32 bytes