pub trait Object: Sized {
// Provided methods
fn id(&self) -> usize { ... }
fn type(&self) -> String { ... }
fn is<T: Object>(&self, other: &Option<T>) -> bool { ... }
fn __getattribute__(&self, _name: impl AsRef<str>) -> Option<impl Object> { ... }
fn __setattribute__<T: Object>(&mut self, _name: impl AsRef<str>, _value: T) { ... }
fn __delattribute__(&mut self, _name: impl AsRef<str>) { ... }
fn __dir__(&self) -> Vec<impl AsRef<str>> { ... }
}
Expand description
The Python Object. Anything that implements this trait is a Python Object.
Provided Methods§
Sourcefn id(&self) -> usize
fn id(&self) -> usize
Returns the unique identifier of the object, which is the memory address of the object.
Sourcefn __getattribute__(&self, _name: impl AsRef<str>) -> Option<impl Object>
fn __getattribute__(&self, _name: impl AsRef<str>) -> Option<impl Object>
getattribute is called to look up an attribute of the object.
Sourcefn __setattribute__<T: Object>(&mut self, _name: impl AsRef<str>, _value: T)
fn __setattribute__<T: Object>(&mut self, _name: impl AsRef<str>, _value: T)
setattribute is called to set an attribute of the object.
Sourcefn __delattribute__(&mut self, _name: impl AsRef<str>)
fn __delattribute__(&mut self, _name: impl AsRef<str>)
delattribute is called to delete an attribute of the object.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.