pub trait DataFormat {
type Output;
// Required methods
fn format_null(&self) -> Self::Output;
fn format_bool(&self, value: &bool) -> Self::Output;
fn format_string(&self, value: &str) -> Self::Output;
fn format_i64(&self, value: &i64) -> Self::Output;
fn format_f64(&self, value: &f64) -> Self::Output;
fn format_ip(&self, value: &IpAddr) -> Self::Output;
fn format_datetime(&self, value: &NaiveDateTime) -> Self::Output;
fn format_object(&self, value: &ObjectValue) -> Self::Output;
fn format_array(&self, value: &[FieldStorage]) -> Self::Output;
fn format_field(&self, field: &FieldStorage) -> Self::Output;
fn format_record(&self, record: &DataRecord) -> Self::Output;
// Provided method
fn fmt_value(&self, value: &Value) -> Self::Output { ... }
}Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.
Expand description
旧的 DataFormat trait
已弃用: 请使用 ValueFormatter 和 RecordFormatter 替代。
这个 trait 将在下一个主要版本中移除。
Required Associated Types§
type Output
Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.
Required Methods§
fn format_null(&self) -> Self::Output
Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.
fn format_bool(&self, value: &bool) -> Self::Output
Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.
fn format_string(&self, value: &str) -> Self::Output
Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.
fn format_i64(&self, value: &i64) -> Self::Output
Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.
fn format_f64(&self, value: &f64) -> Self::Output
Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.
fn format_ip(&self, value: &IpAddr) -> Self::Output
Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.
fn format_datetime(&self, value: &NaiveDateTime) -> Self::Output
Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.
fn format_object(&self, value: &ObjectValue) -> Self::Output
Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.
fn format_array(&self, value: &[FieldStorage]) -> Self::Output
Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.
fn format_field(&self, field: &FieldStorage) -> Self::Output
Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.
fn format_record(&self, record: &DataRecord) -> Self::Output
Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.
Provided Methods§
fn fmt_value(&self, value: &Value) -> Self::Output
Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.