Merge pull request #1323 from dtolnay/format-args
Implement Serialize for core::fmt::Arguments
This commit is contained in:
commit
898f65fa46
@ -69,6 +69,15 @@ impl Serialize for String {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Serialize for fmt::Arguments<'a> {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
serializer.collect_str(self)
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
|
@ -462,6 +462,11 @@ declare_tests! {
|
||||
Token::SeqEnd,
|
||||
],
|
||||
}
|
||||
test_fmt_arguments {
|
||||
format_args!("{}{}", 1, 'a') => &[
|
||||
Token::Str("1a"),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
declare_tests! {
|
||||
|
Loading…
Reference in New Issue
Block a user