40 lines
818 B
Rust
40 lines
818 B
Rust
mod fast_real;
|
|
mod pretty;
|
|
mod standard;
|
|
//mod deterministic;
|
|
|
|
use super::{Write, Result};
|
|
|
|
pub use self::fast_real::*;
|
|
pub use self::pretty::*;
|
|
pub use self::standard::*;
|
|
//pub use self::deterministic::*;
|
|
|
|
pub trait WriteReal<T> {
|
|
fn write_real<W: Write>(w: &mut W, i: T) -> Result<()>;
|
|
}
|
|
|
|
pub trait RealFormat:
|
|
WriteReal<i8> + WriteReal<i16> +
|
|
WriteReal<i32> + WriteReal<i64> +
|
|
WriteReal<u8> + WriteReal<u16> +
|
|
WriteReal<u32> + WriteReal<u64> +
|
|
WriteReal<f32> + WriteReal<f64> {}
|
|
|
|
pub trait FormatEngine: Default {
|
|
fn mark_delim(&mut self, _d: u8) {}
|
|
}
|
|
|
|
impl FormatEngine for () {}
|
|
|
|
pub trait Format {
|
|
type Engine: FormatEngine;
|
|
type RealFormat: RealFormat;
|
|
|
|
#[inline]
|
|
fn write<W: Write>(_e: &mut Self::Engine, w: &mut Write, bytes: &[u8]) -> Result<()> {
|
|
// Passthrough
|
|
w.write(bytes)?;
|
|
Ok(())
|
|
}
|
|
} |