pub struct History<T, L = String> { /* private fields */ }Expand description
元に戻す段(前の状態と、その状態から次への変更の名前 L)と、やり直す段
Implementations§
Source§impl<T, L> History<T, L>
impl<T, L> History<T, L>
Sourcepub fn record_or_merge(&mut self, prev: T, label: L, merge: bool)
pub fn record_or_merge(&mut self, prev: T, label: L, merge: bool)
merge なら前の段にまとめて積まない(元に戻す段が無ければ積む)。どちらでもやり直す段は捨てる
Sourcepub fn step(&mut self, cur: T, back: bool) -> Option<T>
pub fn step(&mut self, cur: T, back: bool) -> Option<T>
1 段戻す(back)・やり直す: 今の状態 cur を反対の段に積み、戻した先の状態を返す。段が無ければ None
Sourcepub fn pop(&mut self, back: bool) -> Option<(T, L)>
pub fn pop(&mut self, back: bool) -> Option<(T, L)>
戻す(back)・やり直す段の一番上を取り出す(反対の段には積まない。Self::pass と組で使う)
Sourcepub fn pass(&mut self, back: bool, item: (T, L))
pub fn pass(&mut self, back: bool, item: (T, L))
Self::pop で戻した(back)・やり直した段の代わりに、反対の段へ積む(やり直す段は捨てない)
Sourcepub fn clear_redo(&mut self)
pub fn clear_redo(&mut self)
やり直す段を捨てる
Trait Implementations§
Auto Trait Implementations§
impl<T, L> Freeze for History<T, L>
impl<T, L> RefUnwindSafe for History<T, L>where
T: RefUnwindSafe,
L: RefUnwindSafe,
impl<T, L> Send for History<T, L>
impl<T, L> Sync for History<T, L>
impl<T, L> Unpin for History<T, L>
impl<T, L> UnsafeUnpin for History<T, L>
impl<T, L> UnwindSafe for History<T, L>where
T: UnwindSafe,
L: UnwindSafe,
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§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more