Struct pyo3_asyncio::TaskLocals
source · pub struct TaskLocals { /* private fields */ }Expand description
Task-local data to store for Python conversions.
Implementations§
source§impl TaskLocals
impl TaskLocals
sourcepub fn with_running_loop(py: Python<'_>) -> PyResult<Self>
pub fn with_running_loop(py: Python<'_>) -> PyResult<Self>
Construct TaskLocals with the event loop returned by get_running_loop
sourcepub fn with_context(self, context: &PyAny) -> Self
pub fn with_context(self, context: &PyAny) -> Self
Manually provide the contextvars for the current task.
sourcepub fn copy_context(self, py: Python<'_>) -> PyResult<Self>
pub fn copy_context(self, py: Python<'_>) -> PyResult<Self>
Capture the current task’s contextvars
sourcepub fn event_loop<'p>(&self, py: Python<'p>) -> &'p PyAny
pub fn event_loop<'p>(&self, py: Python<'p>) -> &'p PyAny
Get a reference to the event loop
Trait Implementations§
source§impl Clone for TaskLocals
impl Clone for TaskLocals
source§fn clone(&self) -> TaskLocals
fn clone(&self) -> TaskLocals
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more