mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-12 23:41:03 +00:00
Store flatten flag in container attributes
This commit is contained in:
committed by
Armin Ronacher
parent
571bb8caed
commit
5ae06bba49
@@ -146,6 +146,7 @@ pub struct Container {
|
||||
remote: Option<syn::Path>,
|
||||
identifier: Identifier,
|
||||
repr: ContainerRepr,
|
||||
has_flatten: bool,
|
||||
}
|
||||
|
||||
/// Styles of representing an enum.
|
||||
@@ -417,6 +418,7 @@ impl Container {
|
||||
remote: remote.get(),
|
||||
identifier: decide_identifier(cx, item, &field_identifier, &variant_identifier),
|
||||
repr: repr.get().unwrap_or(ContainerRepr::Auto),
|
||||
has_flatten: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -467,6 +469,14 @@ impl Container {
|
||||
pub fn repr(&self) -> ContainerRepr {
|
||||
self.repr
|
||||
}
|
||||
|
||||
pub fn has_flatten(&self) -> bool {
|
||||
self.has_flatten
|
||||
}
|
||||
|
||||
pub fn mark_has_flatten(&mut self) {
|
||||
self.has_flatten = true;
|
||||
}
|
||||
}
|
||||
|
||||
fn decide_tag(
|
||||
|
||||
Reference in New Issue
Block a user