Skip to main content

DataFormat

Trait DataFormat 

Source
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 { ... }
}
👎Deprecated since 0.2.0:

Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.

Expand description

旧的 DataFormat trait

已弃用: 请使用 ValueFormatterRecordFormatter 替代。

这个 trait 将在下一个主要版本中移除。

Required Associated Types§

Source

type Output

👎Deprecated since 0.2.0:

Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.

Required Methods§

Source

fn format_null(&self) -> Self::Output

👎Deprecated since 0.2.0:

Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.

Source

fn format_bool(&self, value: &bool) -> Self::Output

👎Deprecated since 0.2.0:

Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.

Source

fn format_string(&self, value: &str) -> Self::Output

👎Deprecated since 0.2.0:

Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.

Source

fn format_i64(&self, value: &i64) -> Self::Output

👎Deprecated since 0.2.0:

Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.

Source

fn format_f64(&self, value: &f64) -> Self::Output

👎Deprecated since 0.2.0:

Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.

Source

fn format_ip(&self, value: &IpAddr) -> Self::Output

👎Deprecated since 0.2.0:

Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.

Source

fn format_datetime(&self, value: &NaiveDateTime) -> Self::Output

👎Deprecated since 0.2.0:

Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.

Source

fn format_object(&self, value: &ObjectValue) -> Self::Output

👎Deprecated since 0.2.0:

Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.

Source

fn format_array(&self, value: &[FieldStorage]) -> Self::Output

👎Deprecated since 0.2.0:

Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.

Source

fn format_field(&self, field: &FieldStorage) -> Self::Output

👎Deprecated since 0.2.0:

Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.

Source

fn format_record(&self, record: &DataRecord) -> Self::Output

👎Deprecated since 0.2.0:

Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.

Provided Methods§

Source

fn fmt_value(&self, value: &Value) -> Self::Output

👎Deprecated since 0.2.0:

Use ValueFormatter and RecordFormatter instead. This trait will be removed in the next major version.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§