pub struct TaskLocals { /* private fields */ }
Expand description
Task-local data to store for Python conversions.
Implementations§
Source§impl TaskLocals
impl TaskLocals
Sourcepub fn new(event_loop: Bound<'_, PyAny>) -> Self
pub fn new(event_loop: Bound<'_, PyAny>) -> Self
At a minimum, TaskLocals must store the event loop.
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: Bound<'_, PyAny>) -> Self
pub fn with_context(self, context: Bound<'_, 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>) -> Bound<'p, PyAny>
pub fn event_loop<'p>(&self, py: Python<'p>) -> Bound<'p, PyAny>
Get a reference to the event loop
Trait Implementations§
Auto 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