[−][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]
fn clone(&self) -> SwitchTargets[src]
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]
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]
fn eq(&self, other: &SwitchTargets) -> bool[src]
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,
fn borrow_mut(&mut self) -> &mut T[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized, [src]
T: ?Sized,
impl<Ctxt, T> DepNodeParams<Ctxt> for T where
Ctxt: DepContext,
T: HashStable<<Ctxt as DepContext>::StableHashingContext> + Debug, [src]
Ctxt: DepContext,
T: HashStable<<Ctxt as DepContext>::StableHashingContext> + Debug,
default fn can_reconstruct_query_key() -> bool[src]
default fn to_fingerprint(&self, tcx: Ctxt) -> Fingerprint[src]
default fn to_debug_str(&self, Ctxt) -> String[src]
default fn recover(Ctxt, &DepNode<<Ctxt as DepContext>::DepKind>) -> Option<T>[src]
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 = !
fn from(Result<T, <T as MaybeResult<T>>::Error>) -> T[src]
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.
fn to_owned(&self) -> T[src]
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.
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.