pub trait PyObjectProtocol<'p>: PyClass {
fn __getattr__(&'p self, name: Self::Name) -> Self::Result
where
Self: PyObjectGetAttrProtocol<'p>,
{ ... }
fn __setattr__(
&'p mut self,
name: Self::Name,
value: Self::Value
) -> Self::Result
where
Self: PyObjectSetAttrProtocol<'p>,
{ ... }
fn __delattr__(&'p mut self, name: Self::Name) -> Self::Result
where
Self: PyObjectDelAttrProtocol<'p>,
{ ... }
fn __str__(&'p self) -> Self::Result
where
Self: PyObjectStrProtocol<'p>,
{ ... }
fn __repr__(&'p self) -> Self::Result
where
Self: PyObjectReprProtocol<'p>,
{ ... }
fn __hash__(&'p self) -> Self::Result
where
Self: PyObjectHashProtocol<'p>,
{ ... }
fn __richcmp__(&'p self, other: Self::Other, op: CompareOp) -> Self::Result
where
Self: PyObjectRichcmpProtocol<'p>,
{ ... }
fn __bool__(&'p self) -> Self::Result
where
Self: PyObjectBoolProtocol<'p>,
{ ... }
}
👎 Deprecated since 0.16.0:
prefer #[pymethods]
to #[pyproto]
Expand description
Basic Python class customization
Provided Methods
fn __getattr__(&'p self, name: Self::Name) -> Self::Result where
Self: PyObjectGetAttrProtocol<'p>,
fn __getattr__(&'p self, name: Self::Name) -> Self::Result where
Self: PyObjectGetAttrProtocol<'p>,
👎 Deprecated since 0.16.0:
prefer #[pymethods]
to #[pyproto]
fn __setattr__(
&'p mut self,
name: Self::Name,
value: Self::Value
) -> Self::Result where
Self: PyObjectSetAttrProtocol<'p>,
fn __setattr__(
&'p mut self,
name: Self::Name,
value: Self::Value
) -> Self::Result where
Self: PyObjectSetAttrProtocol<'p>,
👎 Deprecated since 0.16.0:
prefer #[pymethods]
to #[pyproto]
fn __delattr__(&'p mut self, name: Self::Name) -> Self::Result where
Self: PyObjectDelAttrProtocol<'p>,
fn __delattr__(&'p mut self, name: Self::Name) -> Self::Result where
Self: PyObjectDelAttrProtocol<'p>,
👎 Deprecated since 0.16.0:
prefer #[pymethods]
to #[pyproto]
fn __str__(&'p self) -> Self::Result where
Self: PyObjectStrProtocol<'p>,
fn __str__(&'p self) -> Self::Result where
Self: PyObjectStrProtocol<'p>,
👎 Deprecated since 0.16.0:
prefer #[pymethods]
to #[pyproto]
fn __repr__(&'p self) -> Self::Result where
Self: PyObjectReprProtocol<'p>,
fn __repr__(&'p self) -> Self::Result where
Self: PyObjectReprProtocol<'p>,
👎 Deprecated since 0.16.0:
prefer #[pymethods]
to #[pyproto]
fn __hash__(&'p self) -> Self::Result where
Self: PyObjectHashProtocol<'p>,
fn __hash__(&'p self) -> Self::Result where
Self: PyObjectHashProtocol<'p>,
👎 Deprecated since 0.16.0:
prefer #[pymethods]
to #[pyproto]
fn __richcmp__(&'p self, other: Self::Other, op: CompareOp) -> Self::Result where
Self: PyObjectRichcmpProtocol<'p>,
fn __richcmp__(&'p self, other: Self::Other, op: CompareOp) -> Self::Result where
Self: PyObjectRichcmpProtocol<'p>,
👎 Deprecated since 0.16.0:
prefer #[pymethods]
to #[pyproto]
fn __bool__(&'p self) -> Self::Result where
Self: PyObjectBoolProtocol<'p>,
fn __bool__(&'p self) -> Self::Result where
Self: PyObjectBoolProtocol<'p>,
👎 Deprecated since 0.16.0:
prefer #[pymethods]
to #[pyproto]