pyo3::types

Struct PyAny

Source
pub struct PyAny(/* private fields */);
Expand description

Represents any Python object.

Values of this type are accessed via PyO3’s smart pointers, e.g. as Py<PyAny> or Bound<'py, PyAny>.

For APIs available on all Python objects, see the PyAnyMethods trait which is implemented for Bound<'py, PyAny>.

See the guide for an explanation of the different Python object types.

Trait Implementations§

Source§

impl AsPyPointer for PyAny

Source§

fn as_ptr(&self) -> *mut PyObject

Returns the underlying FFI pointer as a borrowed pointer.
Source§

impl AsRef<PyAny> for CancelledError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for IncompleteReadError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for InvalidStateError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for LimitOverrunError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PanicException

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyArithmeticError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyAssertionError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyAttributeError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyBaseException

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyBlockingIOError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyBool

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyBrokenPipeError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyBufferError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyByteArray

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyBytes

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyBytesWarning

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyCFunction

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyCapsule

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyChildProcessError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyCode

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyComplex

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyConnectionAbortedError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyConnectionError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyConnectionRefusedError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyConnectionResetError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyDate

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyDateTime

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyDelta

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyDeprecationWarning

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyDict

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyDictItems

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyDictKeys

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyDictValues

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyEOFError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyEllipsis

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyEncodingWarning

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyEnvironmentError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyException

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyFileExistsError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyFileNotFoundError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyFloat

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyFloatingPointError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyFrame

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyFrozenSet

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyFunction

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyFutureWarning

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyGeneratorExit

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyIOError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyImportError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyImportWarning

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyIndexError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyInterruptedError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyIsADirectoryError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyIterator

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyKeyError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyKeyboardInterrupt

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyList

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyLong

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyLookupError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyMapping

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyMemoryError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyMemoryView

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyModule

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyModuleNotFoundError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyNameError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyNone

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyNotADirectoryError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyNotImplemented

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyNotImplementedError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyOSError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyOverflowError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyPendingDeprecationWarning

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyPermissionError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyProcessLookupError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyRecursionError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyReferenceError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyResourceWarning

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyRuntimeError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyRuntimeWarning

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PySequence

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PySet

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PySlice

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyStopAsyncIteration

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyStopIteration

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyString

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PySuper

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PySyntaxError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PySyntaxWarning

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PySystemError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PySystemExit

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyTime

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyTimeoutError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyTraceback

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyTuple

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyType

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyTypeError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyTzInfo

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyUnboundLocalError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyUnicodeDecodeError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyUnicodeEncodeError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyUnicodeError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyUnicodeTranslateError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyUnicodeWarning

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyUserWarning

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyValueError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyWarning

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyWeakref

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyWeakrefProxy

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyWeakrefReference

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for PyZeroDivisionError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for QueueEmpty

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for QueueFull

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for TimeoutError

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for gaierror

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for herror

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<PyAny> for timeout

Source§

fn as_ref(&self) -> &PyAny

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl IntoPy<Py<PyAny>> for &PyAny

Source§

fn into_py(self, py: Python<'_>) -> PyObject

Performs the conversion.
Source§

impl PyTypeInfo for PyAny

Source§

const NAME: &'static str = "PyAny"

Class name.
Source§

const MODULE: Option<&'static str> = _

Module name, if any.
Source§

fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject

Returns the PyTypeObject instance for this type.
Source§

fn is_type_of_bound(obj: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type or a subclass of this type.
Source§

fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>

Returns the safe abstraction over the type object.
Source§

fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type.
Source§

impl PyLayout<PyAny> for PyObject

Source§

impl PySizedLayout<PyAny> for PyObject

Auto Trait Implementations§

§

impl !Freeze for PyAny

§

impl !RefUnwindSafe for PyAny

§

impl !Send for PyAny

§

impl !Sync for PyAny

§

impl Unpin for PyAny

§

impl UnwindSafe for PyAny

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PyTypeCheck for T
where T: PyTypeInfo,

Source§

const NAME: &'static str = const NAME: &'static str = <T as PyTypeInfo>::NAME;

Name of self. This is used in error messages, for example.
Source§

fn type_check(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of Self, which may include a subtype. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.