rsdiff_core/ops/traits/
operator.rs

1/*
2    Appellation: operator <module>
3    Contrib: FL03 <jo3mccain@icloud.com>
4*/
5use crate::ops::{OpKind, OperandType};
6
7pub trait Operator {
8    fn kind(&self) -> OpKind;
9
10    fn name(&self) -> &str;
11
12    #[doc(hidden)]
13    fn optype(&self) -> Box<dyn OperandType> {
14        self.kind().optype()
15    }
16}
17
18/*
19 **************** implementations ****************
20*/
21
22impl Operator for Box<dyn Operator> {
23    fn kind(&self) -> OpKind {
24        self.as_ref().kind()
25    }
26
27    fn name(&self) -> &str {
28        self.as_ref().name()
29    }
30}