pub struct Draft { /* private fields */ }Implementations§
Source§impl Draft
impl Draft
pub fn new(sides: &Pairing<Source>) -> Self
Sourcepub fn push(&mut self, next: Move) -> Result<()>
pub fn push(&mut self, next: Move) -> Result<()>
Carry out next on the copy and keep it. A move the applier refuses
is an error, as it would be in the pipeline.
pub fn into_moves(self) -> Vec<Move>
Sourcepub fn paired_leaf(&self, id: u32) -> Result<Option<u32>>
pub fn paired_leaf(&self, id: u32) -> Result<Option<u32>>
The leaf on the other side whose rows pair with the leaf id.
Sourcepub fn collapse(&mut self, id: u32, label: String) -> Result<()>
pub fn collapse(&mut self, id: u32, label: String) -> Result<()>
Start id collapsed behind label, and with it every region in its
fold state. The leaf paired with a leaf id takes the label too. Any
other region in the fold state that was open loses its label, so it
reads as part of id’s row rather than as its own placeholder.
Sourcepub fn link(&mut self, ids: &[u32]) -> Result<()>
pub fn link(&mut self, ids: &[u32]) -> Result<()>
Open and close ids together, collapsed if any region in their fold
states starts collapsed. A region that was open and so starts
collapsed loses its label, as in Draft::collapse.
Sourcepub fn cut_lines(&mut self, id: u32, start: u32, end: u32) -> Result<u32>
pub fn cut_lines(&mut self, id: u32, start: u32, end: u32) -> Result<u32>
Cut the lines start..end, relative to the leaf id’s first line
and half-open, out of it (and so out of the leaf paired with it),
returning the id of the piece on id’s side that holds them. The
leaf keeps its id for the lines before start.