Struct puff_rs::context::PuffContext
source · [−]pub struct PuffContext { /* private fields */ }Expand description
The central control structure for dispatching tasks onto coroutine workers. All tasks in the same runtime will have access to the same dispatcher. The dispatcher contains a reference to the parent Tokio Runtime as well as references to all coroutine workers.
Implementations
sourceimpl PuffContext
impl PuffContext
sourcepub fn empty(handle: Handle) -> PuffContext
pub fn empty(handle: Handle) -> PuffContext
Creates an empty RuntimeDispatcher with no active threads for testing.
sourcepub fn new(handle: Handle) -> PuffContext
pub fn new(handle: Handle) -> PuffContext
Creates a new RuntimeDispatcher using the supplied RuntimeConfig.
sourcepub fn new_with_options(
handle: Handle,
redis: Option<RedisClient>,
postgres: Option<PostgresClient>,
python_dispatcher: Option<PythonDispatcher>,
pubsub_client: Option<PubSubClient>,
gql_root: Option<Arc<RootNode<'static, PuffGqlObject, PuffGqlObject, PuffGqlObject, AggroScalarValue>>>
) -> PuffContext
pub fn new_with_options(
handle: Handle,
redis: Option<RedisClient>,
postgres: Option<PostgresClient>,
python_dispatcher: Option<PythonDispatcher>,
pubsub_client: Option<PubSubClient>,
gql_root: Option<Arc<RootNode<'static, PuffGqlObject, PuffGqlObject, PuffGqlObject, AggroScalarValue>>>
) -> PuffContext
Creates a new RuntimeDispatcher using the supplied RuntimeConfig. This function will start
the number of coroutine_threads specified in your config. Includes options.
sourcepub fn pubsub(&self) -> PubSubClient
pub fn pubsub(&self) -> PubSubClient
The global configured PubSubClient
sourcepub fn python_dispatcher(&self) -> PythonDispatcher
pub fn python_dispatcher(&self) -> PythonDispatcher
A Handle into the multi-threaded async runtime
sourcepub fn redis(&self) -> RedisClient
pub fn redis(&self) -> RedisClient
The configured redis client. Panics if not enabled.
sourcepub fn postgres(&self) -> PostgresClient
pub fn postgres(&self) -> PostgresClient
The configured postgres client. Panics if not enabled.
Trait Implementations
sourceimpl Clone for PuffContext
impl Clone for PuffContext
sourcefn clone(&self) -> PuffContext
fn clone(&self) -> PuffContext
Returns a copy of the value. Read more
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceimpl Default for PuffContext
impl Default for PuffContext
sourceimpl Puff for PuffContext
impl Puff for PuffContext
Auto Trait Implementations
impl !RefUnwindSafe for PuffContext
impl Send for PuffContext
impl Sync for PuffContext
impl Unpin for PuffContext
impl !UnwindSafe for PuffContext
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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