[−][src]Struct desync::desync::Desync
A data storage structure used to govern synchronous and asynchronous access to an underlying object.
Methods
impl<T: 'static + Send> Desync<T>
[src]
pub fn new(data: T) -> Desync<T>
[src]
Creates a new Desync object
pub fn async<TFn>(&self, job: TFn) where
TFn: 'static + Send + FnOnce(&mut T),
[src]
TFn: 'static + Send + FnOnce(&mut T),
please use desync
instead
Performs an operation asynchronously on this item. This function will return immediately and the job will happen on a separate thread at some time in the future (generally fairly soon).
Jobs are always performed in the order that they are queued and are always performed synchronously with respect to this object.
pub fn desync<TFn>(&self, job: TFn) where
TFn: 'static + Send + FnOnce(&mut T),
[src]
TFn: 'static + Send + FnOnce(&mut T),
Performs an operation asynchronously on this item. This function will return immediately and the job will happen on a separate thread at some time in the future (generally fairly soon).
Jobs are always performed in the order that they are queued and are always performed synchronously with respect to this object.
pub fn sync<TFn, Result>(&self, job: TFn) -> Result where
TFn: Send + FnOnce(&mut T) -> Result,
Result: Send,
[src]
TFn: Send + FnOnce(&mut T) -> Result,
Result: Send,
Performs an operation synchronously on this item. This will be queued with any other jobs that this item may be performing, and this function will not return until the job is complete and the result is available.
pub fn future<TFn, Item: 'static + Send>(
&self,
job: TFn
) -> impl Future<Item = Item, Error = Canceled> + Send where
TFn: 'static + Send + FnOnce(&mut T) -> Item,
[src]
&self,
job: TFn
) -> impl Future<Item = Item, Error = Canceled> + Send where
TFn: 'static + Send + FnOnce(&mut T) -> Item,
Performs an operation asynchronously on the contents of this item, returning the result via a future.
pub fn after<'a, TFn, Item: 'static + Send, Error: 'static + Send, Res: 'static + Send, Fut: 'a + Future<Item = Item, Error = Error> + Send>(
&self,
after: Fut,
job: TFn
) -> impl 'a + Future<Item = Res, Error = Error> + Send where
TFn: 'static + Send + FnOnce(&mut T, Result<Item, Error>) -> Result<Res, Error>,
[src]
&self,
after: Fut,
job: TFn
) -> impl 'a + Future<Item = Res, Error = Error> + Send where
TFn: 'static + Send + FnOnce(&mut T, Result<Item, Error>) -> Result<Res, Error>,
After the pending operations for this item are performed, waits for the supplied future to complete and then calls the specified function
Trait Implementations
impl<T: Send> Sync for Desync<T>
[src]
impl<T: Send> Send for Desync<T>
[src]
impl<T: Send> Drop for Desync<T>
[src]
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,