Skip to main content

Draft

Struct Draft 

Source
pub struct Draft { /* private fields */ }

Implementations§

Source§

impl Draft

Source

pub fn new(sides: &Pairing<Source>) -> Self

Source

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.

Source

pub fn into_moves(self) -> Vec<Move>

Source

pub fn paired_leaf(&self, id: u32) -> Result<Option<u32>>

The leaf on the other side whose rows pair with the leaf id.

Source

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.

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.

Source

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.

Source

pub fn group(&mut self, ids: Vec<u32>, label: String) -> Result<()>

Wrap ids, consecutive siblings on each side that holds them, in a new fold on each such side, starting collapsed behind label.

Auto Trait Implementations§

§

impl Freeze for Draft

§

impl RefUnwindSafe for Draft

§

impl Send for Draft

§

impl Sync for Draft

§

impl Unpin for Draft

§

impl UnsafeUnpin for Draft

§

impl UnwindSafe for Draft

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Resource for T
where T: 'static,

Source§

type Rep = Option<T>

The type which is actually stored in-memory for this resource. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.