pub struct Node {
pub id: String,
pub x: usize,
pub y: usize,
pub w: usize,
pub h: usize,
}Expand description
Represents an item in the grid with position and dimensions.
A node occupies a rectangular area in the grid defined by:
- Its top-left corner position (x, y)
- Its dimensions (width, height)
- A unique identifier
The node’s area can be iterated over using the for_cell method,
which visits each cell in the node’s occupied space.
Fields§
§id: StringUnique identifier for the node
x: usizeX coordinate of the top-left corner
y: usizeY coordinate of the top-left corner
w: usizeWidth of the node in grid cells
h: usizeHeight of the node in grid cells
Implementations§
Source§impl Node
impl Node
Sourcepub fn new(
id: impl Into<String>,
x: usize,
y: usize,
w: usize,
h: usize,
) -> Node
pub fn new( id: impl Into<String>, x: usize, y: usize, w: usize, h: usize, ) -> Node
Creates a new Node with the specified parameters.
§Arguments
id- Unique identifier for the nodex- X coordinate of the top-left cornery- Y coordinate of the top-left cornerw- Width in grid cellsh- Height in grid cells
Trait Implementations§
impl Eq for Node
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
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