pub struct Coroutine {
name: Option<Py<PyString>>,
qualname_prefix: Option<&'static str>,
throw_callback: Option<ThrowCallback>,
future: Option<Pin<Box<dyn Future<Output = PyResult<Py<PyAny>>> + Send>>>,
waker: Option<Arc<AsyncioWaker>>,
}Available on crate feature
experimental-async only.Expand description
Python coroutine wrapping a Future.
Fields§
§name: Option<Py<PyString>>§qualname_prefix: Option<&'static str>§throw_callback: Option<ThrowCallback>§future: Option<Pin<Box<dyn Future<Output = PyResult<Py<PyAny>>> + Send>>>§waker: Option<Arc<AsyncioWaker>>Implementations§
impl Coroutine
Source§impl Coroutine
impl Coroutine
#[doc(hidden)]pub const _PYO3_INTROSPECTION_ID: &'static str = "1917796429675682910"
impl Coroutine
Source§impl Coroutine
impl Coroutine
Sourcepub(crate) fn new<'py, F>(
name: Option<Bound<'py, PyString>>,
qualname_prefix: Option<&'static str>,
throw_callback: Option<ThrowCallback>,
future: F,
) -> Self
pub(crate) fn new<'py, F>( name: Option<Bound<'py, PyString>>, qualname_prefix: Option<&'static str>, throw_callback: Option<ThrowCallback>, future: F, ) -> Self
Wrap a future into a Python coroutine.
Coroutine send polls the wrapped future, ignoring the value passed
(should always be None anyway).
Coroutine throw` drop the wrapped future and reraise the exception passed
fn poll( &mut self, py: Python<'_>, throw: Option<Py<PyAny>>, ) -> PyResult<Py<PyAny>>
Source§impl Coroutine
impl Coroutine
fn __name__(&self, py: Python<'_>) -> PyResult<Py<PyString>>
fn __qualname__<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyString>>
fn send( &mut self, py: Python<'_>, _value: &Bound<'_, PyAny>, ) -> PyResult<Py<PyAny>>
fn throw(&mut self, py: Python<'_>, exc: Py<PyAny>) -> PyResult<Py<PyAny>>
fn close(&mut self)
fn __await__(self_: Py<Self>) -> Py<Self>
fn __next__(&mut self, py: Python<'_>) -> PyResult<Py<PyAny>>
Source§impl Coroutine
impl Coroutine
unsafe fn __pymethod_get___name____( py: Python<'_>, _slf: NonNull<PyObject>, ) -> PyResult<*mut PyObject>
unsafe fn __pymethod_get___qualname____( py: Python<'_>, _slf: NonNull<PyObject>, ) -> PyResult<*mut PyObject>
unsafe fn __pymethod_send__<'py>( py: Python<'py>, _slf: *mut PyObject, _args: *const *mut PyObject, _nargs: Py_ssize_t, _kwargs: *mut PyObject, ) -> PyResult<*mut PyObject>
unsafe fn __pymethod_throw__<'py>( py: Python<'py>, _slf: *mut PyObject, _args: *const *mut PyObject, _nargs: Py_ssize_t, _kwargs: *mut PyObject, ) -> PyResult<*mut PyObject>
unsafe fn __pymethod_close__<'py>( py: Python<'py>, _slf: *mut PyObject, ) -> PyResult<*mut PyObject>
unsafe fn __pymethod___await____( py: Python<'_>, _slf: *mut PyObject, ) -> PyResult<*mut PyObject>
unsafe fn __pymethod___next____( py: Python<'_>, _slf: *mut PyObject, ) -> PyResult<*mut PyObject>
Trait Implementations§
Source§impl<'py> IntoPyObject<'py> for Coroutine
impl<'py> IntoPyObject<'py> for Coroutine
Source§const OUTPUT_TYPE: PyStaticExpr = <Coroutine as crate::PyTypeInfo>::TYPE_HINT
const OUTPUT_TYPE: PyStaticExpr = <Coroutine as crate::PyTypeInfo>::TYPE_HINT
Available on crate feature
experimental-inspect only.Extracts the type hint information for this type when it appears as a return value. Read more
Source§type Output = Bound<'py, <Coroutine as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <Coroutine as IntoPyObject<'py>>::Target>
The smart pointer type to use. Read more
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Performs the conversion.
Source§#[doc(hidden)]fn owned_sequence_into_pyobject<I>(
iter: I,
py: Python<'py>,
_: Token,
) -> Result<Bound<'py, PyAny>, PyErr>
#[doc(hidden)]fn owned_sequence_into_pyobject<I>(
iter: I,
py: Python<'py>,
_: Token,
) -> Result<Bound<'py, PyAny>, PyErr>
Converts sequence of Self into a Python object. Used to specialize
Vec<u8>, [u8; N]
and SmallVec<[u8; N]> as a sequence of bytes into a bytes object.Source§#[doc(hidden)]const SEQUENCE_OUTPUT_TYPE: PyStaticExpr = _
#[doc(hidden)]const SEQUENCE_OUTPUT_TYPE: PyStaticExpr = _
Available on crate feature
experimental-inspect only.The output type of
IntoPyObject::owned_sequence_into_pyobject and IntoPyObject::borrowed_sequence_into_pyobjectSource§impl PyClassImpl for Coroutine
impl PyClassImpl for Coroutine
Source§const MODULE: Option<&str> = ::core::option::Option::None
const MODULE: Option<&str> = ::core::option::Option::None
Module which the class will be associated with. Read more
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
#[pyclass(subclass)]
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
#[pyclass(extends=…)]
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
#[pyclass(mapping)]
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
#[pyclass(sequence)]
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
#[pyclass(immutable_type)]
Source§const RAW_DOC: &'static CStr = /// Python coroutine wrapping a [`Future`].
const RAW_DOC: &'static CStr = /// Python coroutine wrapping a [`Future`].
Docstring for the class provided on the struct or enum. Read more
Source§const DOC: &'static CStr
const DOC: &'static CStr
Fully rendered class doc, including the
text_signature if a constructor is defined. Read moreSource§type Layout = <<Coroutine as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<Coroutine>
type Layout = <<Coroutine as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<Coroutine>
Description of how this class is laid out in memory
Source§type ThreadChecker = NoopThreadChecker
type ThreadChecker = NoopThreadChecker
This handles following two situations: Read more
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Immutable or mutable
Source§type Dict = PyClassDummySlot
type Dict = PyClassDummySlot
Specify this class has
#[pyclass(dict)] or not.Source§type WeakRef = PyClassDummySlot
type WeakRef = PyClassDummySlot
Specify this class has
#[pyclass(weakref)] or not.Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
The closest native ancestor. This is
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter ⓘ
fn lazy_type_object() -> &'static LazyTypeObject<Self>
Source§fn dict_offset() -> Option<PyObjectOffset>
fn dict_offset() -> Option<PyObjectOffset>
Used to provide the dictoffset slot
(equivalent to tp_dictoffset)
Source§fn weaklist_offset() -> Option<PyObjectOffset>
fn weaklist_offset() -> Option<PyObjectOffset>
Used to provide the weaklistoffset slot
(equivalent to tp_weaklistoffset
Source§impl PyMethods<Coroutine> for PyClassImplCollector<Coroutine>
impl PyMethods<Coroutine> for PyClassImplCollector<Coroutine>
Source§fn py_methods(self) -> &'static PyClassItems
fn py_methods(self) -> &'static PyClassItems
Available on non-crate feature
multiple-pymethods only.Source§impl PyTypeInfo for Coroutine
impl PyTypeInfo for Coroutine
Source§const NAME: &str = <Self as crate::PyClass>::NAME
const NAME: &str = <Self as crate::PyClass>::NAME
👎Deprecated since 0.28.0:
prefer using ::type_object(py).name() to get the correct runtime value
Class name.
Source§const MODULE: Option<&str> = <Self as crate::impl_::pyclass::PyClassImpl>::MODULE
const MODULE: Option<&str> = <Self as crate::impl_::pyclass::PyClassImpl>::MODULE
👎Deprecated since 0.28.0:
prefer using ::type_object(py).module() to get the correct runtime value
Module name, if any.
Source§const TYPE_HINT: PyStaticExpr
const TYPE_HINT: PyStaticExpr
Available on crate feature
experimental-inspect only.Provides the full python type as a type hint.
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Returns the PyTypeObject instance for this type.
Source§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
Returns the safe abstraction over the type object.
impl DerefToPyAny for Coroutine
impl ExtractPyClassWithClone for Coroutine
impl Sync for Coroutine
Auto Trait Implementations§
impl Freeze for Coroutine
impl !RefUnwindSafe for Coroutine
impl Send for Coroutine
impl Unpin for Coroutine
impl UnsafeUnpin for Coroutine
impl !UnwindSafe for Coroutine
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<'py, T> IntoPyCallbackOutput<'py, *mut PyObject> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyCallbackOutput<'py, *mut PyObject> for Twhere
T: IntoPyObject<'py>,
Source§impl<'py, T> IntoPyCallbackOutput<'py, Py<PyAny>> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyCallbackOutput<'py, Py<PyAny>> for Twhere
T: IntoPyObject<'py>,
Source§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
Source§fn into_bound_py_any(self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>>
fn into_bound_py_any(self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>>
Converts
self into an owned Python object, dropping type information.Source§impl<'py, T> PyClassInit<'py, false, false> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> PyClassInit<'py, false, false> for Twhere
T: IntoPyObject<'py>,
Source§impl<'py, T> PyClassInit<'py, true, false> for Twhere
T: PyClass,
<T as PyClassImpl>::BaseType: PyClassBaseType<Initializer = PyNativeTypeInitializer<<T as PyClassImpl>::BaseType>>,
impl<'py, T> PyClassInit<'py, true, false> for Twhere
T: PyClass,
<T as PyClassImpl>::BaseType: PyClassBaseType<Initializer = PyNativeTypeInitializer<<T as PyClassImpl>::BaseType>>,
Source§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
Source§impl<'a, T> PyReturnType for Twhere
T: IntoPyObject<'a>,
impl<'a, T> PyReturnType for Twhere
T: IntoPyObject<'a>,
Source§const OUTPUT_TYPE: PyStaticExpr = const OUTPUT_TYPE: PyStaticExpr = T::OUTPUT_TYPE;
const OUTPUT_TYPE: PyStaticExpr = const OUTPUT_TYPE: PyStaticExpr = T::OUTPUT_TYPE;
Available on crate feature
experimental-inspect only.The function return type
Source§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
Source§const NAME: &'static str = const NAME: &'static str = T::NAME;
const NAME: &'static str = const NAME: &'static str = T::NAME;
👎Deprecated since 0.27.0:
Use ::classinfo_object() instead and format the type name at runtime. Note that using built-in cast features is often better than manual PyTypeCheck usage.
Name of self. This is used in error messages, for example.
Source§const TYPE_HINT: PyStaticExpr = const TYPE_HINT: PyStaticExpr = <T as PyTypeInfo>::TYPE_HINT;
const TYPE_HINT: PyStaticExpr = const TYPE_HINT: PyStaticExpr = <T as PyTypeInfo>::TYPE_HINT;
Available on crate feature
experimental-inspect only.Provides the full python type of the allowed values as a Python type hint.
Source§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize = _
#[doc(hidden)]const SIZE: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize = _
#[doc(hidden)]const ALIGN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment = _
#[doc(hidden)]const ALIGNMENT: Alignment = _
🔬This is a nightly-only experimental API. (
ptr_alignment_type)Source§#[doc(hidden)]const IS_ZST: bool = _
#[doc(hidden)]const IS_ZST: bool = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const LAYOUT: Layout = _
#[doc(hidden)]const LAYOUT: Layout = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const MAX_SLICE_LEN: usize = _
#[doc(hidden)]const MAX_SLICE_LEN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)The largest safe length for a
[Self]. Read more