Trait node_replication::Dispatch[][src]

pub trait Dispatch {
    type ReadOperation: Sized + Clone + PartialEq + Debug;
    type WriteOperation: Sized + Clone + PartialEq + Debug + Send;
    type Response: Sized + Clone;
    fn dispatch(&self, op: Self::ReadOperation) -> Self::Response;
fn dispatch_mut(&mut self, op: Self::WriteOperation) -> Self::Response; }
Expand description

Trait that a data structure must implement to be usable with this library.

When this library executes a read-only operation against the data structure, it invokes the dispatch() method with the operation as an argument.

When this library executes a write operation against the data structure, it invokes the dispatch_mut() method with the operation as an argument.

Associated Types

A read-only operation. When executed against the data structure, an operation of this type must not mutate the data structure in anyway. Otherwise, the assumptions made by this library no longer hold.

A write operation. When executed against the data structure, an operation of this type is allowed to mutate state. The library ensures that this is done so in a thread-safe manner.

The type on the value returned by the data structure when a ReadOperation or a WriteOperation successfully executes against it.

Required methods

Method on the data structure that allows a read-only operation to be executed against it.

Method on the data structure that allows a write operation to be executed against it.

Implementors