///
/// The memory region between `pos` (inclusive) and `end` (exclusive) is valid for writes if `pos`
/// is less than `end`.
-pub(crate) struct RawFormatter {
+pub struct RawFormatter {
// Use `usize` to use `saturating_*` functions.
beg: usize,
pos: usize,
}
/// Returns the number of bytes written to the formatter.
- pub(crate) fn bytes_written(&self) -> usize {
+ pub fn bytes_written(&self) -> usize {
self.pos - self.beg
}
}
/// Allows formatting of [`fmt::Arguments`] into a raw buffer.
///
/// Fails if callers attempt to write more than will fit in the buffer.
-pub(crate) struct Formatter<'a>(RawFormatter, PhantomData<&'a mut ()>);
+pub struct Formatter<'a>(RawFormatter, PhantomData<&'a mut ()>);
impl Formatter<'_> {
/// Creates a new instance of [`Formatter`] with the given buffer.
}
/// Create a new [`Self`] instance.
- #[expect(dead_code)]
- pub(crate) fn new(buffer: &mut [u8]) -> Self {
+ pub fn new(buffer: &mut [u8]) -> Self {
// SAFETY: `buffer` is valid for writes for the entire length for
// the lifetime of `Self`.
unsafe { Formatter::from_buffer(buffer.as_mut_ptr(), buffer.len()) }