pub struct Data<T>{ /* private fields */ }Expand description
A generic container for a piece of data, associated with a unique identifier.
Data<T> is a fundamental building block for representing discrete pieces of
information within a larger system, such as a context or a causal graph. It
wraps a data payload of type T and pairs it with a u64 ID, allowing the
data to be uniquely identified and referenced.
The struct is designed to be lightweight and efficient, deriving Copy and Clone
to allow for easy duplication. The trait bounds on T ensure that the contained
data is also simple and value-like.
§Type Parameters
T: The type of the data payload. It must be a simple, copyable, and comparable type, satisfying theDefault + Copy + Clone + Hash + Eq + PartialEqbounds.
Implementations§
Trait Implementations§
Source§impl<T> Adjustable<T> for Data<T>
impl<T> Adjustable<T> for Data<T>
Source§fn update<const WIDTH: usize, const HEIGHT: usize, const DEPTH: usize, const TIME: usize>(
&mut self,
array_grid: &ArrayGrid<T, WIDTH, HEIGHT, DEPTH, TIME>,
) -> Result<(), UpdateError>
fn update<const WIDTH: usize, const HEIGHT: usize, const DEPTH: usize, const TIME: usize>( &mut self, array_grid: &ArrayGrid<T, WIDTH, HEIGHT, DEPTH, TIME>, ) -> Result<(), UpdateError>
The default implementation does nothing to keep update optional.
Override this method to implement a node update when needed.
For a sample implementation, see src/types/context_types/node_types_adjustable
Source§fn adjust<const WIDTH: usize, const HEIGHT: usize, const DEPTH: usize, const TIME: usize>(
&mut self,
array_grid: &ArrayGrid<T, WIDTH, HEIGHT, DEPTH, TIME>,
) -> Result<(), AdjustmentError>
fn adjust<const WIDTH: usize, const HEIGHT: usize, const DEPTH: usize, const TIME: usize>( &mut self, array_grid: &ArrayGrid<T, WIDTH, HEIGHT, DEPTH, TIME>, ) -> Result<(), AdjustmentError>
The default implementation does nothing to keep adjustment optional.
Override this method to implement a node adjustment when needed.
Depending on the type of node adjustment, select a 1, 2,3, or 4 dimensional array grid
that contains the transformation data to apply to the node.
For a sample implementation, see src/types/context_types/node_types_adjustable
Source§impl<T> Datable for Data<T>
Implements the Datable trait for Data<T>.
impl<T> Datable for Data<T>
Implements the Datable trait for Data<T>.
This allows Data<T> to be used in contexts where a generic data container
is expected, providing methods to get and set the inner data payload.
Source§impl<T> Identifiable for Data<T>
impl<T> Identifiable for Data<T>
impl<T> Copy for Data<T>
impl<T> StructuralPartialEq for Data<T>
Auto Trait Implementations§
impl<T> Freeze for Data<T>where
T: Freeze,
impl<T> RefUnwindSafe for Data<T>where
T: RefUnwindSafe,
impl<T> Send for Data<T>where
T: Send,
impl<T> Sync for Data<T>where
T: Sync,
impl<T> Unpin for Data<T>where
T: Unpin,
impl<T> UnwindSafe for Data<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more