[−][src]Struct rustpython_vm::pyobject::PyObject
This is an actual python object. It consists of a typ
which is the
python class, and carries some rust payload optionally. This rust
payload can be a rust float or rust int in case of float and int objects.
Fields
typ: PyClassRef
dict: Option<RefCell<PyDictRef>>
payload: T
Methods
impl PyObject<dyn PyObjectPayload>
[src]
pub fn downcast<T: PyObjectPayload>(
self: Rc<Self>
) -> Result<PyRef<T>, PyObjectRef>
[src]
self: Rc<Self>
) -> Result<PyRef<T>, PyObjectRef>
Attempt to downcast this reference to a subclass.
If the downcast fails, the original ref is returned in as Err
so
another downcast can be attempted without unnecessary cloning.
impl<T> PyObject<T> where
T: Sized + PyObjectPayload,
[src]
T: Sized + PyObjectPayload,
pub fn new(payload: T, typ: PyClassRef, dict: Option<PyDictRef>) -> PyObjectRef
[src]
pub fn into_ref(self) -> PyObjectRef
[src]
impl PyObject<dyn PyObjectPayload>
[src]
pub fn payload<T: PyObjectPayload>(&self) -> Option<&T>
[src]
pub fn payload_is<T: PyObjectPayload>(&self) -> bool
[src]
pub fn payload_if_subclass<T: PyObjectPayload + PyValue>(
&self,
vm: &VirtualMachine
) -> Option<&T>
[src]
&self,
vm: &VirtualMachine
) -> Option<&T>
Trait Implementations
impl Debug for PyObject<dyn PyObjectPayload>
[src]
impl Display for PyObject<dyn PyObjectPayload>
[src]
impl<T: ?Sized + PyObjectPayload> IdProtocol for PyObject<T>
[src]
impl<T: ?Sized> TypeProtocol for PyObject<T> where
T: PyObjectPayload,
[src]
T: PyObjectPayload,
fn class(&self) -> PyClassRef
[src]
Auto Trait Implementations
impl<T> !RefUnwindSafe for PyObject<T>
impl<T> !Send for PyObject<T>
impl<T> !Sync for PyObject<T>
impl<T: ?Sized> Unpin for PyObject<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for PyObject<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,