#[doc(hidden)]
#[macro_export]
macro_rules! __multitude_format {
(in $arena:expr, $($arg:tt)*) => {{
let mut __multitude_buf = $crate::Arena::alloc_string($arena);
::core::fmt::Write::write_fmt(
&mut __multitude_buf,
::core::format_args!($($arg)*),
)
.expect("a formatting trait implementation returned an error");
__multitude_buf
}};
}
use core::fmt;
use allocator_api2::alloc::Allocator;
use crate::strings::String;
impl<A: Allocator + Clone> fmt::Write for String<'_, A> {
#[allow(
clippy::map_err_ignore,
reason = "fmt::Error carries no payload; the original AllocError has no useful information to preserve"
)]
fn write_str(&mut self, s: &str) -> fmt::Result {
self.try_push_str(s).map_err(|_| fmt::Error)
}
#[allow(
clippy::map_err_ignore,
reason = "fmt::Error carries no payload; the original AllocError has no useful information to preserve"
)]
fn write_char(&mut self, c: char) -> fmt::Result {
self.try_push(c).map_err(|_| fmt::Error)
}
}