mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-26 00:27:56 +00:00
Merge pull request #1044 from Marwes/human_readable
Serialize to binary if the serde format is not human readable
This commit is contained in:
@@ -1363,6 +1363,15 @@ pub trait Serializer: Sized {
|
||||
fn collect_str<T: ?Sized>(self, value: &T) -> Result<Self::Ok, Self::Error>
|
||||
where
|
||||
T: Display;
|
||||
|
||||
/// Returns wheter the data format is human readable or not.
|
||||
///
|
||||
/// Some formats are not intended to be human readable. For these formats
|
||||
/// a type being serialized may opt to serialize into a more compact form.
|
||||
///
|
||||
/// NOTE: Implementing this method and returning `false` is considered a breaking
|
||||
/// change as it may alter how any given type tries to serialize itself.
|
||||
fn is_human_readable(&self) -> bool { true }
|
||||
}
|
||||
|
||||
/// Returned from `Serializer::serialize_seq`.
|
||||
|
||||
Reference in New Issue
Block a user