chandra/core/operations/
range.rs1use std::{marker::PhantomData};
2
3use crate::core::{operation::{Operation, OperationWrapper}, type_traits::Iterable, processor::cpu::DifferentiatedCPUContext};
4
5use super::add::Add;
6
7pub fn range<LEFT: Operation<u32>, RIGHT: Operation<u32>>(
8 left: LEFT,
9 right: RIGHT,
10) -> OperationWrapper<u32, Range<LEFT, RIGHT>> {
11 OperationWrapper(
12 Range {
13 left: left,
14 right: right
15 },
16 PhantomData,
17 )
18}
19
20#[derive(Clone, Debug)]
21pub struct Range<LEFT: Operation<u32>, RIGHT: Operation<u32>> {
22 pub left: LEFT,
23 pub right: RIGHT,
24}
25
26impl<LEFT: Operation<u32>, RIGHT: Operation<u32>> Operation<u32> for Range<LEFT, RIGHT> {
27 fn evaluate(&self, _context: &mut DifferentiatedCPUContext) -> u32 {
28 todo!("Figure out if this needs to be called") }
30}
31
32impl<LEFT: Operation<u32>, RIGHT: Operation<u32>> Iterable<u32> for Range<LEFT, RIGHT> {
33 type StartOp = LEFT;
34
35 type NextOp = OperationWrapper<u32, Add<u32, LEFT, u32>>;
36
37 type BoundryOp = RIGHT;
38
39 fn get_start(&self) -> Self::StartOp {
40 return self.left.clone();
41 }
42
43 fn get_next(&self) -> Self::NextOp {
44 todo!()
45 }
46
47 fn get_boundry(&self) -> Self::BoundryOp {
48 self.right.clone()
49 }
50}