pumpkin_core/engine/variables/transformable_variable.rs
1/// Trait for transforming a variable.
2///
3/// At the moment this allows creating a scaled version of a
4/// variable using [`TransformableVariable::scaled`] or creating a variable with a constant offset
5/// based on the original variable using [`TransformableVariable::offset`].
6pub trait TransformableVariable<View> {
7 /// Get a variable which domain is scaled compared to the domain of self.
8 ///
9 /// The scaled domain will have holes in it. E.g. if we have `dom(x) = {1, 2}`, then
10 /// `dom(x.scaled(2)) = {2, 4}` and *not* `dom(x.scaled(2)) = {1, 2, 3, 4}`.
11 fn scaled(&self, scale: i32) -> View;
12
13 /// Get a variable which domain has a constant offset to the domain of self.
14 fn offset(&self, offset: i32) -> View;
15}