Skip to main content

graphrecords_query/traits/
conversion.rs

1use crate::{
2    ValueDomain,
3    cast::CastTarget,
4    operations::{Apply, TransitionOperation},
5};
6
7pub trait Cast<T: CastTarget> {
8    type ReturnOperand;
9
10    fn cast(&self, target: T) -> Self::ReturnOperand;
11}
12
13pub trait DiscardIndex {
14    type ReturnOperand;
15
16    fn discard_index(&self) -> Self::ReturnOperand;
17}
18
19pub trait DiscardValue {
20    type ReturnOperand;
21
22    fn discard_value(&self) -> Self::ReturnOperand;
23}
24
25pub trait Enumerate {
26    type ReturnOperand;
27
28    fn enumerate(&self) -> Self::ReturnOperand;
29}
30
31pub trait ExpandTo<T> {
32    type ReturnOperand;
33
34    fn expand_to(&self, template: &T) -> Self::ReturnOperand;
35}
36
37pub trait Transition {
38    type ReturnOperand<T>
39    where
40        T: ValueDomain,
41        Self: Apply<TransitionOperation<T>>;
42
43    fn transition<T>(&self) -> Self::ReturnOperand<T>
44    where
45        T: ValueDomain,
46        Self: Apply<TransitionOperation<T>>;
47}