Struct rustc_middle::mir::terminator::SwitchTargets [−][src]
Fields
values: SmallVec<[u128; 1]>Expand description
Possible values. The locations to branch to in each case
are found in the corresponding indices from the targets vector.
targets: SmallVec<[BasicBlock; 2]>Expand description
Possible branch sites. The last element of this vector is used for the otherwise branch, so targets.len() == values.len() + 1 should hold.
Implementations
impl SwitchTargets[src]
impl SwitchTargets[src]pub fn new(
targets: impl Iterator<Item = (u128, BasicBlock)>,
otherwise: BasicBlock
) -> Self[src]
pub fn new(
targets: impl Iterator<Item = (u128, BasicBlock)>,
otherwise: BasicBlock
) -> Self[src]Creates switch targets from an iterator of values and target blocks.
The iterator may be empty, in which case the SwitchInt instruction is equivalent to
goto otherwise;.
pub fn static_if(value: u128, then: BasicBlock, else_: BasicBlock) -> Self[src]
pub fn static_if(value: u128, then: BasicBlock, else_: BasicBlock) -> Self[src]Builds a switch targets definition that jumps to then if the tested value equals value,
and to else_ if not.
pub fn otherwise(&self) -> BasicBlock[src]
pub fn otherwise(&self) -> BasicBlock[src]Returns the fallback target that is jumped to when none of the values match the operand.
pub fn iter(&self) -> SwitchTargetsIter<'_>ⓘNotable traits for SwitchTargetsIter<'a>
impl<'a> Iterator for SwitchTargetsIter<'a> type Item = (u128, BasicBlock);[src]
pub fn iter(&self) -> SwitchTargetsIter<'_>ⓘNotable traits for SwitchTargetsIter<'a>
impl<'a> Iterator for SwitchTargetsIter<'a> type Item = (u128, BasicBlock);[src]Returns an iterator over the switch targets.
The iterator will yield tuples containing the value and corresponding target to jump to, not
including the otherwise fallback target.
Note that this may yield 0 elements. Only the otherwise branch is mandatory.
pub fn all_targets(&self) -> &[BasicBlock]ⓘ[src]
pub fn all_targets(&self) -> &[BasicBlock]ⓘ[src]Returns a slice with all possible jump targets (including the fallback target).
pub fn all_targets_mut(&mut self) -> &mut [BasicBlock]ⓘ[src]
Trait Implementations
impl Clone for SwitchTargets[src]
impl Clone for SwitchTargets[src]fn clone(&self) -> SwitchTargets[src]
fn clone(&self) -> SwitchTargets[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]Performs copy-assignment from source. Read more
impl Debug for SwitchTargets[src]
impl Debug for SwitchTargets[src]impl<'tcx, __D: TyDecoder<'tcx>> Decodable<__D> for SwitchTargets[src]
impl<'tcx, __D: TyDecoder<'tcx>> Decodable<__D> for SwitchTargets[src]impl<'tcx, __E: TyEncoder<'tcx>> Encodable<__E> for SwitchTargets[src]
impl<'tcx, __E: TyEncoder<'tcx>> Encodable<__E> for SwitchTargets[src]impl Hash for SwitchTargets[src]
impl Hash for SwitchTargets[src]impl<'__ctx> HashStable<StableHashingContext<'__ctx>> for SwitchTargets[src]
impl<'__ctx> HashStable<StableHashingContext<'__ctx>> for SwitchTargets[src]fn hash_stable(
&self,
__hcx: &mut StableHashingContext<'__ctx>,
__hasher: &mut StableHasher
)[src]
&self,
__hcx: &mut StableHashingContext<'__ctx>,
__hasher: &mut StableHasher
)
impl PartialEq<SwitchTargets> for SwitchTargets[src]
impl PartialEq<SwitchTargets> for SwitchTargets[src]fn eq(&self, other: &SwitchTargets) -> bool[src]
fn eq(&self, other: &SwitchTargets) -> bool[src]This method tests for self and other values to be equal, and is used
by ==. Read more
fn ne(&self, other: &SwitchTargets) -> bool[src]
fn ne(&self, other: &SwitchTargets) -> bool[src]This method tests for !=.
impl PartialOrd<SwitchTargets> for SwitchTargets[src]
impl PartialOrd<SwitchTargets> for SwitchTargets[src]fn partial_cmp(&self, other: &SwitchTargets) -> Option<Ordering>[src]
fn partial_cmp(&self, other: &SwitchTargets) -> Option<Ordering>[src]This method returns an ordering between self and other values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl StructuralPartialEq for SwitchTargets[src]
Auto Trait Implementations
impl RefUnwindSafe for SwitchTargets
impl Send for SwitchTargets
impl Sync for SwitchTargets
impl Unpin for SwitchTargets
impl UnwindSafe for SwitchTargets
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> MaybeResult<T> for T[src]
impl<T> MaybeResult<T> for T[src]impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> WithConstness for T[src]
impl<T> WithConstness for T[src]fn with_constness(self, constness: Constness) -> ConstnessAnd<Self>[src]
fn with_const(self) -> ConstnessAnd<Self>[src]
fn without_const(self) -> ConstnessAnd<Self>[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized, [src]
T: ?Sized,