pub struct UndoRedoManager<P: Project> { /* private fields */ }Implementations§
Source§impl<P: Project> UndoRedoManager<P>
impl<P: Project> UndoRedoManager<P>
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/slides.rs (line 298)
269fn main() {
270
271 let mut client = alisa::Client::<SlipsProject>::local("my_cool_path.slips").unwrap();
272
273 let mut action = alisa::Action::new();
274 client.perform(&mut action, SetName {
275 name: "My Cool Name".to_string(),
276 });
277
278 if let Some(ptr) = client.next_ptr() {
279 client.perform(&mut action, CreateSlide {
280 ptr,
281 parent: (),
282 idx: client.project().slides.n_children(),
283 data: SlideTreeData {
284 title: "New Slide".to_owned(),
285 text_boxes: alisa::UnorderedChildListTreeData::default()
286 },
287 });
288 }
289
290 client.tick(&mut ());
291
292 for slide_ptr in client.project().slides.iter() {
293 if let Some(slide) = client.get(slide_ptr) {
294 println!("{}", slide.title);
295 }
296 }
297
298 let mut undo_redo = alisa::UndoRedoManager::new();
299
300 // Add the action to the list of undo's
301 undo_redo.add(action);
302
303 // If there's an action to undo, undo it
304 undo_redo.undo(&client);
305
306 client.tick(&mut ());
307
308}Sourcepub fn add(&self, action: Action<P>)
pub fn add(&self, action: Action<P>)
Examples found in repository?
examples/slides.rs (line 301)
269fn main() {
270
271 let mut client = alisa::Client::<SlipsProject>::local("my_cool_path.slips").unwrap();
272
273 let mut action = alisa::Action::new();
274 client.perform(&mut action, SetName {
275 name: "My Cool Name".to_string(),
276 });
277
278 if let Some(ptr) = client.next_ptr() {
279 client.perform(&mut action, CreateSlide {
280 ptr,
281 parent: (),
282 idx: client.project().slides.n_children(),
283 data: SlideTreeData {
284 title: "New Slide".to_owned(),
285 text_boxes: alisa::UnorderedChildListTreeData::default()
286 },
287 });
288 }
289
290 client.tick(&mut ());
291
292 for slide_ptr in client.project().slides.iter() {
293 if let Some(slide) = client.get(slide_ptr) {
294 println!("{}", slide.title);
295 }
296 }
297
298 let mut undo_redo = alisa::UndoRedoManager::new();
299
300 // Add the action to the list of undo's
301 undo_redo.add(action);
302
303 // If there's an action to undo, undo it
304 undo_redo.undo(&client);
305
306 client.tick(&mut ());
307
308}pub fn can_undo(&self) -> bool
pub fn can_redo(&self) -> bool
Sourcepub fn undo(&mut self, client: &Client<P>)
pub fn undo(&mut self, client: &Client<P>)
Examples found in repository?
examples/slides.rs (line 304)
269fn main() {
270
271 let mut client = alisa::Client::<SlipsProject>::local("my_cool_path.slips").unwrap();
272
273 let mut action = alisa::Action::new();
274 client.perform(&mut action, SetName {
275 name: "My Cool Name".to_string(),
276 });
277
278 if let Some(ptr) = client.next_ptr() {
279 client.perform(&mut action, CreateSlide {
280 ptr,
281 parent: (),
282 idx: client.project().slides.n_children(),
283 data: SlideTreeData {
284 title: "New Slide".to_owned(),
285 text_boxes: alisa::UnorderedChildListTreeData::default()
286 },
287 });
288 }
289
290 client.tick(&mut ());
291
292 for slide_ptr in client.project().slides.iter() {
293 if let Some(slide) = client.get(slide_ptr) {
294 println!("{}", slide.title);
295 }
296 }
297
298 let mut undo_redo = alisa::UndoRedoManager::new();
299
300 // Add the action to the list of undo's
301 undo_redo.add(action);
302
303 // If there's an action to undo, undo it
304 undo_redo.undo(&client);
305
306 client.tick(&mut ());
307
308}pub fn redo(&mut self, client: &Client<P>)
Auto Trait Implementations§
impl<P> !Freeze for UndoRedoManager<P>
impl<P> !RefUnwindSafe for UndoRedoManager<P>
impl<P> !Send for UndoRedoManager<P>
impl<P> !Sync for UndoRedoManager<P>
impl<P> Unpin for UndoRedoManager<P>
impl<P> !UnwindSafe for UndoRedoManager<P>
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