pub trait HostObject: Send + Sync {
// Required methods
fn host_eq(&self, other: &dyn HostObject) -> bool;
fn host_repr(&self) -> String;
fn host_str(&self) -> String;
fn host_hash(&self) -> Option<u64>;
fn host_cmp(&self, other: &dyn HostObject) -> Option<Ordering>;
fn as_any(&self) -> &dyn Any;
// Provided methods
fn host_pprint(&self) -> String { ... }
fn host_eq_scalar(&self, _other: &Scalar) -> bool { ... }
fn host_type_name(&self) -> String { ... }
}Expand description
A host-language value an object cell carries - the Python binding’s objects: compared and printed by the host itself.
Required Methods§
Sourcefn host_eq(&self, other: &dyn HostObject) -> bool
fn host_eq(&self, other: &dyn HostObject) -> bool
self == other in the host language.
Sourcefn host_cmp(&self, other: &dyn HostObject) -> Option<Ordering>
fn host_cmp(&self, other: &dyn HostObject) -> Option<Ordering>
self ordered against other in the host language (Python’s < /
> / ==), None where the host cannot order them (a date against a
time, two dicts).
Provided Methods§
Sourcefn host_pprint(&self) -> String
fn host_pprint(&self) -> String
The cell as pandas displays it in a repr (pprint_thing), where that
differs from its str: a tuple’s or array’s items unquoted ((a, 1),
[1, 2]); by default its str.
Sourcefn host_eq_scalar(&self, _other: &Scalar) -> bool
fn host_eq_scalar(&self, _other: &Scalar) -> bool
self == other in the host language for a plain value (numpy’s
dtype('float64') == 'float64' is True); false unless the host says so.
Sourcefn host_type_name(&self) -> String
fn host_type_name(&self) -> String
The value’s type as the host’s own errors name it (datetime.date,
dict), for a refusal pandas lets the host raise.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".