deep_causality/traits/adjustable/
mod.rs

1/*
2 * SPDX-License-Identifier: MIT
3 * Copyright (c) 2023 - 2026. The DeepCausality Authors and Contributors. All Rights Reserved.
4 */
5
6use crate::errors::{AdjustmentError, UpdateError};
7use deep_causality_data_structures::ArrayGrid;
8
9pub trait Adjustable<T>
10where
11    T: Copy + Default,
12{
13    /// The default implementation does nothing to keep update optional.
14    /// Override this method to implement a node update when needed.
15    /// For a sample implementation, see src/types/context_types/node_types_adjustable
16    fn update<const WIDTH: usize, const HEIGHT: usize, const DEPTH: usize, const TIME: usize>(
17        &mut self,
18        _array_grid: &ArrayGrid<T, WIDTH, HEIGHT, DEPTH, TIME>,
19    ) -> Result<(), UpdateError> {
20        Ok(())
21    }
22
23    /// The default implementation does nothing to keep adjustment optional.
24    /// Override this method to implement a node adjustment when needed.
25    /// Depending on the type of node adjustment, select a 1, 2,3, or 4 dimensional array grid
26    /// that contains the transformation data to apply to the node.
27    /// For a sample implementation, see src/types/context_types/node_types_adjustable
28    fn adjust<const WIDTH: usize, const HEIGHT: usize, const DEPTH: usize, const TIME: usize>(
29        &mut self,
30        _array_grid: &ArrayGrid<T, WIDTH, HEIGHT, DEPTH, TIME>,
31    ) -> Result<(), AdjustmentError> {
32        Ok(())
33    }
34}
35
36pub trait UncertainAdjustable {
37    type Data;
38
39    fn update(&mut self, _uncertain: Self::Data) -> Result<(), AdjustmentError> {
40        Ok(())
41    }
42
43    fn adjust(&mut self, _uncertain: Self::Data) -> Result<(), AdjustmentError> {
44        Ok(())
45    }
46}