Struct aper::data_structures::List
source · [−]pub struct List<T: StateMachine + PartialEq> { /* private fields */ }
Expand description
Represents a list of items, similar to a Vec
, but designed to be robust
to concurrent modifications from multiple users.
Implementations
sourceimpl<T: StateMachine + PartialEq> List<T>
impl<T: StateMachine + PartialEq> List<T>
pub fn new() -> List<T>
pub fn get_location(&self, position: ListPosition) -> ZenoIndex
pub fn insert_between(
&self,
id1: &Uuid,
id2: &Uuid,
value: T
) -> OperationWithId<T>
sourcepub fn append(&self, value: T) -> OperationWithId<T>
pub fn append(&self, value: T) -> OperationWithId<T>
Construct an OperationWithId representing appending the given object to this list.
sourcepub fn prepend(&self, value: T) -> OperationWithId<T>
pub fn prepend(&self, value: T) -> OperationWithId<T>
Construct a OperationWithId representing prepending the given object to this list.
sourcepub fn insert(&self, location: ZenoIndex, value: T) -> OperationWithId<T>
pub fn insert(&self, location: ZenoIndex, value: T) -> OperationWithId<T>
Construct a OperationWithId representing inserting the given object at the given location in this list.
sourcepub fn delete(&self, id: Uuid) -> ListOperation<T>
pub fn delete(&self, id: Uuid) -> ListOperation<T>
Construct a ListOperation representing deleting the object given (by id) in this list.
sourcepub fn move_item(&self, id: Uuid, new_location: ZenoIndex) -> ListOperation<T>
pub fn move_item(&self, id: Uuid, new_location: ZenoIndex) -> ListOperation<T>
Construct a ListOperation representing moving an object already in this list to the given location in the list.
pub fn map_item(
&self,
id: Uuid,
fun: impl FnOnce(&T) -> <T as StateMachine>::Transition
) -> <Self as StateMachine>::Transition
Trait Implementations
sourceimpl<T: StateMachine + PartialEq> Default for List<T>
impl<T: StateMachine + PartialEq> Default for List<T>
sourceimpl<'de, T: StateMachine + PartialEq> Deserialize<'de> for List<T>
impl<'de, T: StateMachine + PartialEq> Deserialize<'de> for List<T>
sourcefn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<T: StateMachine + PartialEq> Serialize for List<T>
impl<T: StateMachine + PartialEq> Serialize for List<T>
sourceimpl<T: StateMachine + PartialEq> StateMachine for List<T>
impl<T: StateMachine + PartialEq> StateMachine for List<T>
type Transition = ListOperation<T>
type Transition = ListOperation<T>
The StateMachine::Transition
type associates another type with this state machine
as its transitions. Read more
type Conflict = ListConflict<T>
sourcefn apply(
&mut self,
transition_event: Self::Transition
) -> Result<(), ListConflict<T>>
fn apply(
&mut self,
transition_event: Self::Transition
) -> Result<(), ListConflict<T>>
Update the state machine according to the given [Transition
]. This method must be
deterministic: calling it on a clone of the state with a clone of the [Transition
]
must result in the same state, even at a different time and on a different machine. This
is the requirement that allows Aper to keep the state in sync across multiple machines. Read more
impl<T: StateMachine + PartialEq> StructuralPartialEq for List<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for List<T> where
T: RefUnwindSafe,
impl<T> Send for List<T>
impl<T> Sync for List<T>
impl<T> Unpin for List<T>
impl<T> UnwindSafe for List<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more