pub struct DragDrop { /* private fields */ }Expand description
The shared drag-and-drop model (DND-1). Tracks where each item currently lives
(placement), the in-flight drag (dragging + hover), and the moves
committed since the host last drained them.
Implementations§
Source§impl DragDrop
impl DragDrop
pub fn new() -> Self
Sourcepub fn place(&mut self, item: impl Into<String>, zone: impl Into<String>)
pub fn place(&mut self, item: impl Into<String>, zone: impl Into<String>)
Declare (or move, non-interactively) an item into a zone — how the host seeds the board from its data, or re-homes an item after rejecting a move.
Sourcepub fn items_in(&self, zone: &str) -> Vec<&str>
pub fn items_in(&self, zone: &str) -> Vec<&str>
The items currently in a zone (sorted, deterministic).
Sourcepub fn is_dragging(&self) -> bool
pub fn is_dragging(&self) -> bool
Whether a drag is in flight.
Sourcepub fn drain_moves(&mut self) -> Vec<Move>
pub fn drain_moves(&mut self) -> Vec<Move>
Drain the moves committed since the last call. The host applies each as a
transition (mirrors kanban’s take_moves).
Sourcepub fn update(&mut self, msg: DragMsg) -> Vec<DragEffect>
pub fn update(&mut self, msg: DragMsg) -> Vec<DragEffect>
The single mutation path (FC-2 / FC-8). Apply one DragMsg; return
the DragEffects the host should run (empty = nothing to do).
Sourcepub fn state_json(&self) -> Value
pub fn state_json(&self) -> Value
Observable state as JSON (the state_json discipline) — placements, the
in-flight drag, and undrained moves, so a headless test asserts the board
without a display.