Skip to main content

define_xyz_mapping

Macro define_xyz_mapping 

Source
macro_rules! define_xyz_mapping {
    ($XYZ_a:ident, $XYZ_b:ident) => { ... };
}
Expand description

Creates bidirectional conversions between two XYZ dimension types.

ยงExample

use feagi_structures::{define_xyz_dimensions, define_xyz_mapping, FeagiDataError};

define_xyz_dimensions!(VolumeA, u32, "VolumeA", 0, "Volume type A");
define_xyz_dimensions!(VolumeB, u32, "VolumeB", 0, "Volume type B");
define_xyz_mapping!(VolumeA, VolumeB);

let vol_a = VolumeA::new(10, 20, 30).unwrap();
let vol_b: VolumeB = vol_a.into();
let back_to_a: VolumeA = vol_b.into();
assert_eq!(vol_a, back_to_a);