pub struct GateNode {
pub id: Arc<str>,
pub coordinates: HashMap<Arc<str>, f32>,
}Expand description
A node in a gate, representing a control point with coordinates in raw data space.
Gate nodes store coordinates for multiple channels, allowing gates to be defined
in multi-dimensional space. Coordinates are stored as f32 values in raw data units.
§Example
use flow_gates::GateNode;
let node = GateNode::new("node1")
.with_coordinate("FSC-A", 1000.0)
.with_coordinate("SSC-A", 2000.0);
assert_eq!(node.get_coordinate("FSC-A"), Some(1000.0));Fields§
§id: Arc<str>Unique identifier for this node
coordinates: HashMap<Arc<str>, f32>Coordinates in raw data space, keyed by channel name.
Using Arc<str> for channel names reduces allocations since they’re shared
across multiple nodes and gates.
Implementations§
Source§impl GateNode
impl GateNode
Sourcepub fn new(id: impl Into<Arc<str>>) -> Self
pub fn new(id: impl Into<Arc<str>>) -> Self
Create a new gate node with the given ID.
The node starts with no coordinates. Use with_coordinate or set_coordinate
to add coordinate values.
Sourcepub fn with_coordinate(self, channel: impl Into<Arc<str>>, value: f32) -> Self
pub fn with_coordinate(self, channel: impl Into<Arc<str>>, value: f32) -> Self
Add a coordinate value using the builder pattern.
Returns self for method chaining.
Sourcepub fn get_coordinate(&self, channel: &str) -> Option<f32>
pub fn get_coordinate(&self, channel: &str) -> Option<f32>
Get a coordinate value for the specified channel.
Returns None if the channel is not present in this node.
pub fn set_coordinate(&mut self, channel: impl Into<Arc<str>>, value: f32)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for GateNode
impl<'de> Deserialize<'de> for GateNode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for GateNode
impl RefUnwindSafe for GateNode
impl Send for GateNode
impl Sync for GateNode
impl Unpin for GateNode
impl UnwindSafe for GateNode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more