add string stream convenience util; add ?Sized bounds on log fmt functors
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
e9ab548445
commit
f98bfbbdcd
2 changed files with 14 additions and 4 deletions
|
@ -30,6 +30,16 @@ macro_rules! is_format {
|
|||
};
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn collect_stream<F>(func: F) -> Result<String>
|
||||
where
|
||||
F: FnOnce(&mut dyn std::fmt::Write) -> Result<()>,
|
||||
{
|
||||
let mut out = String::new();
|
||||
func(&mut out)?;
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn camel_to_snake_string(s: &str) -> String {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue