mod alloc_;
mod array;
mod cell;
#[cfg(feature = "ip_in_core")]
mod net;
mod num;
mod ops;
mod ptr;
mod slice;
use super::*;
use crate::export;
impl<T> Format for Option<T>
where
T: Format,
{
default_format!();
#[inline]
fn _format_tag() -> Str {
internp!("None|Some({=?})")
}
#[inline]
fn _format_data(&self) {
match self {
None => export::u8(&0),
Some(x) => {
export::u8(&1);
export::istr(&T::_format_tag());
x._format_data()
}
}
}
}
impl<T, E> Format for Result<T, E>
where
T: Format,
E: Format,
{
default_format!();
#[inline]
fn _format_tag() -> Str {
internp!("Err({=?})|Ok({=?})")
}
#[inline]
fn _format_data(&self) {
match self {
Err(e) => {
export::u8(&0);
export::istr(&E::_format_tag());
e._format_data()
}
Ok(x) => {
export::u8(&1);
export::istr(&T::_format_tag());
x._format_data()
}
}
}
}
impl<T> Format for core::marker::PhantomData<T> {
default_format!();
#[inline]
fn _format_tag() -> Str {
internp!("PhantomData")
}
#[inline]
fn _format_data(&self) {}
}
impl Format for core::convert::Infallible {
default_format!();
#[inline]
fn _format_tag() -> Str {
unreachable!();
}
#[inline]
fn _format_data(&self) {
unreachable!();
}
}
impl Format for core::time::Duration {
fn format(&self, fmt: Formatter) {
crate::write!(
fmt,
"Duration {{ secs: {=u64}, nanos: {=u32} }}",
self.as_secs(),
self.subsec_nanos(),
)
}
}
impl<A, B> Format for core::iter::Zip<A, B>
where
A: Format,
B: Format,
{
fn format(&self, fmt: Formatter) {
crate::write!(fmt, "Zip(..)")
}
}