Skip to content

Commit

Permalink
Merge pull request #1 from Roba1993/Roba1993-public-formatter
Browse files Browse the repository at this point in the history
Make Formatter functions public
  • Loading branch information
Roba1993 authored Oct 23, 2023
2 parents f2494fa + f9148a7 commit fe7ae0a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions crates/rune/src/runtime/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,40 +37,40 @@ impl Formatter {
}

#[inline]
pub(crate) fn with_capacity(capacity: usize) -> alloc::Result<Self> {
pub fn with_capacity(capacity: usize) -> alloc::Result<Self> {
Ok(Self {
string: String::try_with_capacity(capacity)?,
buf: String::new(),
})
}

#[inline]
pub(crate) fn parts_mut(&mut self) -> (&mut String, &str) {
pub fn parts_mut(&mut self) -> (&mut String, &str) {
(&mut self.string, &self.buf)
}

#[inline]
pub(crate) fn buf_mut(&mut self) -> &mut String {
pub fn buf_mut(&mut self) -> &mut String {
&mut self.buf
}

#[inline]
pub(crate) fn push(&mut self, c: char) -> alloc::Result<()> {
pub fn push(&mut self, c: char) -> alloc::Result<()> {
self.string.try_push(c)
}

#[inline]
pub(crate) fn push_str(&mut self, s: &str) -> alloc::Result<()> {
pub fn push_str(&mut self, s: &str) -> alloc::Result<()> {
self.string.try_push_str(s)
}

#[inline]
pub(crate) fn into_string(self) -> String {
pub fn into_string(self) -> String {
self.string
}

#[inline]
pub(crate) fn as_str(&self) -> &str {
pub fn as_str(&self) -> &str {
&self.string
}
}
Expand Down

0 comments on commit fe7ae0a

Please sign in to comment.