pub enum Operand {
LocalOperand {
name: Name,
ty: TypeRef,
},
ConstantOperand(ConstantRef),
MetadataOperand,
}Variants§
LocalOperand
e.g., i32 %foo
ConstantOperand(ConstantRef)
includes GlobalReference for things like @foo
MetadataOperand
Implementations§
Source§impl Operand
impl Operand
Sourcepub fn as_constant(&self) -> Option<&Constant>
pub fn as_constant(&self) -> Option<&Constant>
Get a reference to the Constant, if the operand is a constant;
otherwise, returns None.
This allows nested matching on Operand. Instead of the following code
(which doesn’t compile because you can’t directly match on ConstantRef)
ⓘ
if let Operand::ConstantOperand(Constant::Float(Float::Double(val))) = opyou can write this:
ⓘ
if let Some(Constant::Float(Float::Double(val))) = op.as_constant()Trait Implementations§
impl StructuralPartialEq for Operand
Auto Trait Implementations§
impl Freeze for Operand
impl RefUnwindSafe for Operand
impl Send for Operand
impl Sync for Operand
impl Unpin for Operand
impl UnwindSafe for Operand
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