Struct pyo3::types::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 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 PyInt

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 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§

fn type_output() -> TypeInfo

Extracts the type hint information for this type when it appears as a return value. Read more
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> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
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>,

§

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>,

§

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.