[−][src]Struct rustc_middle::mir::terminator::SwitchTargets
Fields
values: SmallVec<[u128; 1]>Possible values. The locations to branch to in each case
are found in the corresponding indices from the targets vector.
targets: SmallVec<[BasicBlock; 2]>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]
pub fn new(
targets: impl Iterator<Item = (u128, BasicBlock)>,
otherwise: BasicBlock
) -> Self[src]
targets: impl Iterator<Item = (u128, BasicBlock)>,
otherwise: BasicBlock
) -> Self
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]
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]
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]
Notable traits for SwitchTargetsIter<'a>
impl<'a> Iterator for SwitchTargetsIter<'a> type Item = (u128, BasicBlock);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]
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]
pub fn clone(&self) -> SwitchTargets[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Debug for SwitchTargets[src]
impl<'tcx, __D: TyDecoder<'tcx>> Decodable<__D> for SwitchTargets[src]
impl<'tcx, __E: TyEncoder<'tcx>> Encodable<__E> for SwitchTargets[src]
impl<'__ctx> HashStable<StableHashingContext<'__ctx>> for SwitchTargets[src]
pub 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]
pub fn eq(&self, other: &SwitchTargets) -> bool[src]
pub fn ne(&self, other: &SwitchTargets) -> bool[src]
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> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> MaybeResult<T> for T[src]
type Error = !
pub fn from(Result<T, <T as MaybeResult<T>>::Error>) -> T[src]
pub fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.