melior/ir/value/
value_like.rs1use super::Type;
2use mlir_sys::{
3 mlirValueDump, mlirValueGetType, mlirValueIsABlockArgument, mlirValueIsAOpResult, MlirValue,
4};
5
6pub trait ValueLike<'c> {
8 fn to_raw(&self) -> MlirValue;
10
11 fn r#type(&self) -> Type<'c> {
13 unsafe { Type::from_raw(mlirValueGetType(self.to_raw())) }
14 }
15
16 fn is_block_argument(&self) -> bool {
18 unsafe { mlirValueIsABlockArgument(self.to_raw()) }
19 }
20
21 fn is_operation_result(&self) -> bool {
23 unsafe { mlirValueIsAOpResult(self.to_raw()) }
24 }
25
26 fn dump(&self) {
28 unsafe { mlirValueDump(self.to_raw()) }
29 }
30}