Skip to content

Commit 56ab816

Browse files
Andreas Hindborgkawasaki
authored andcommitted
rust: str: expose str::Formatter::new publicly.
rnull is going to make use of `str::Formatter`, so expose it with public visibility. Signed-off-by: Andreas Hindborg <[email protected]>
1 parent 0c10321 commit 56ab816

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

rust/kernel/str.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ mod tests {
703703
///
704704
/// The memory region between `pos` (inclusive) and `end` (exclusive) is valid for writes if `pos`
705705
/// is less than `end`.
706-
pub(crate) struct RawFormatter {
706+
pub struct RawFormatter {
707707
// Use `usize` to use `saturating_*` functions.
708708
beg: usize,
709709
pos: usize,
@@ -795,7 +795,7 @@ impl fmt::Write for RawFormatter {
795795
/// Allows formatting of [`fmt::Arguments`] into a raw buffer.
796796
///
797797
/// Fails if callers attempt to write more than will fit in the buffer.
798-
pub(crate) struct Formatter<'a>(RawFormatter, PhantomData<&'a mut ()>);
798+
pub struct Formatter<'a>(RawFormatter, PhantomData<&'a mut ()>);
799799

800800
impl Formatter<'_> {
801801
/// Creates a new instance of [`Formatter`] with the given buffer.
@@ -810,8 +810,7 @@ impl Formatter<'_> {
810810
}
811811

812812
/// Create a new [`Self`] instance.
813-
#[expect(dead_code)]
814-
pub(crate) fn new<'a>(buffer: &'a mut [u8]) -> Formatter<'a> {
813+
pub fn new<'a>(buffer: &'a mut [u8]) -> Formatter<'a> {
815814
// SAFETY: `buffer` is valid for writes for the entire length for
816815
// the lifetime of `Self`.
817816
unsafe { Formatter::from_buffer(buffer.as_mut_ptr(), buffer.len()) }

0 commit comments

Comments
 (0)