Skip to main content

ProjectHistory

Struct ProjectHistory 

Source
pub struct ProjectHistory { /* private fields */ }
Expand description

Historial de snapshots con undo/redo.

Cada acción que modifica el proyecto (añadir nota, mover fader, etc.) debe llamar push() antes de aplicarse para poder deshacerse.

El historial mantiene un máximo de snapshots para limitar el uso de memoria.

Implementations§

Source§

impl ProjectHistory

Source

pub fn new(max_snapshots: usize) -> Self

Source

pub fn with_max_bytes(self, bytes: usize) -> Self

Source

pub fn push( &mut self, schema: &ProjectSchema, label: impl Into<String>, ) -> ProjectResult<()>

Guarda el estado actual antes de una acción. Llamar ANTES de modificar el proyecto.

Limpia el historial de redo (no se puede hacer redo después de una acción nueva).

Source

pub fn undo( &mut self, current: &ProjectSchema, ) -> ProjectResult<Option<ProjectSchema>>

Deshace la última acción. Devuelve el schema anterior y guarda el estado actual en future.

Source

pub fn redo( &mut self, current: &ProjectSchema, ) -> ProjectResult<Option<ProjectSchema>>

Rehace la última acción deshecha.

Source

pub fn can_undo(&self) -> bool

Source

pub fn can_redo(&self) -> bool

Source

pub fn undo_label(&self) -> Option<&str>

Descripción de la acción que se desharía.

Source

pub fn redo_label(&self) -> Option<&str>

Descripción de la acción que se reharía.

Source

pub fn depth(&self) -> usize

Source

pub fn future_depth(&self) -> usize

Source

pub fn memory_usage(&self) -> usize

Uso de memoria en bytes.

Source

pub fn clear(&mut self)

Limpia todo el historial (ej. al guardar el proyecto).

Source

pub fn history_labels(&self) -> Vec<&str>

Lista de labels del historial (más reciente primero).

Auto Trait Implementations§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.