Function tir_core::utils::op_has_trait

source ยท
pub fn op_has_trait<T: ?Sized + 'static>(op: OpRef) -> bool
Expand description

Check if an operation was registered to implement trait T

See op_dyn_cast for more info on registering traits.

Example:

use tir_core::{OpRef, utils::op_has_trait, Terminator};

fn test(op: OpRef) {
    if op_has_trait::<dyn Terminator>(op) {
        // do smth useful
    }
}