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 moreAuto Trait Implementations§
impl Freeze for TaskLocals
impl !RefUnwindSafe for TaskLocals
impl Send for TaskLocals
impl Sync for TaskLocals
impl Unpin for TaskLocals
impl UnwindSafe for TaskLocals
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more