pub struct LayoutNodeData {
pub layout: String,
pub variable: String,
pub px: f32,
pub py: f32,
}
Expand description
Structure for sending data about NodeLayout
to frontend.
Some fields of LayoutNodeData
are simplified compared to NodeLayout
(e.g., pure Strings
instead of more complex typesafe structs) to allow for easier (de)serialization.
layout
is a string ID of the node’s layoutvariable
is a string ID of the node’s variablepx
andpy
are the node’s coordinates
Fields§
§layout: String
§variable: String
§px: f32
§py: f32
Implementations§
source§impl LayoutNodeData
impl LayoutNodeData
sourcepub fn new(layout_id: &str, var_id: &str, px: f32, py: f32) -> LayoutNodeData
pub fn new(layout_id: &str, var_id: &str, px: f32, py: f32) -> LayoutNodeData
Create new LayoutNodeData
instance given a node’s layout ID, variable ID, and coordinates.
sourcepub fn from_node(
layout_id: &LayoutId,
var_id: &VarId,
node: &LayoutNode,
) -> LayoutNodeData
pub fn from_node( layout_id: &LayoutId, var_id: &VarId, node: &LayoutNode, ) -> LayoutNodeData
Create new LayoutNodeData
instance given a node’s layout ID, variable ID,
and corresponding LayoutNode
.
sourcepub fn to_node(&self) -> LayoutNode
pub fn to_node(&self) -> LayoutNode
Extract new LayoutNode
instance from this data.
Trait Implementations§
source§impl Clone for LayoutNodeData
impl Clone for LayoutNodeData
source§fn clone(&self) -> LayoutNodeData
fn clone(&self) -> LayoutNodeData
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for LayoutNodeData
impl Debug for LayoutNodeData
source§impl<'de> Deserialize<'de> for LayoutNodeData
impl<'de> Deserialize<'de> for LayoutNodeData
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<'de> JsonSerde<'de> for LayoutNodeData
impl<'de> JsonSerde<'de> for LayoutNodeData
source§fn to_json_str(&self) -> String
fn to_json_str(&self) -> String
Wrapper for json serialization.
source§fn to_pretty_json_str(&self) -> String
fn to_pretty_json_str(&self) -> String
Wrapper for pretty json serialization with indentation.
source§impl PartialEq for LayoutNodeData
impl PartialEq for LayoutNodeData
source§impl Serialize for LayoutNodeData
impl Serialize for LayoutNodeData
impl StructuralPartialEq for LayoutNodeData
Auto Trait Implementations§
impl Freeze for LayoutNodeData
impl RefUnwindSafe for LayoutNodeData
impl Send for LayoutNodeData
impl Sync for LayoutNodeData
impl Unpin for LayoutNodeData
impl UnwindSafe for LayoutNodeData
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)