pub trait Visitor {
type Value;
type Error;
// Required methods
fn error<T: Into<String>>(msg: T) -> Self::Error;
fn visit_u64(self, n: u64) -> Result<Self::Value, Self::Error>;
fn visit_i64(self, n: i64) -> Result<Self::Value, Self::Error>;
fn visit_f64(self, n: f64) -> Result<Self::Value, Self::Error>;
}
Expand description
Trait to access the value stored in Number
.
The Number
type does not directly expose its internal
structure to allow future changes without breaking the API.
Instead, you can implement this trait and pass your implementation
to Number::visit
.