Skip to main content

SArc

Type Alias SArc 

Source
pub type SArc<Storage, T> = SharedState<Arc<<Storage as SharedStorageView>::Storage<T>>, Storage, T>;
Expand description

Shared state backed by Arc<Storage::Storage<T>>.

This is the thread-safe counterpart to SRc. It is useful when the backend is selected by a public type alias or a generic parameter:

use magicstatemachines::{MutexStorage, SArc};

type SharedConnection = SArc<MutexStorage, Connection>;

let shared = SharedConnection::new::<Disconnected>(
    Connection::new("localhost:8080"),
);

Use SArcMutex or SArcRwLock for the built-in backends when no custom storage choice is needed.

Aliased Type§

pub struct SArc<Storage, T> { /* private fields */ }