pub struct Struct<'w, 'k, W: Write> {
ser: ElementSerializer<'w, 'k, W>,
children: String,
}
Expand description
A serializer for struct variants, which serializes the struct contents inside
of wrapping tags (<${tag}>...</${tag}>
).
Serialization of each field depends on it representation:
- attributes written directly to the higher serializer
- elements buffered into internal buffer and at the end written into higher serializer
Fields§
§ser: ElementSerializer<'w, 'k, W>
§children: String
Buffer to store serialized elements
Implementations§
Source§impl<'w, 'k, W: Write> Struct<'w, 'k, W>
impl<'w, 'k, W: Write> Struct<'w, 'k, W>
fn write_field<T>(&mut self, key: &str, value: &T) -> Result<(), DeError>
Sourcefn write_attribute<T>(
&mut self,
key: XmlName<'_>,
value: &T,
) -> Result<(), DeError>
fn write_attribute<T>( &mut self, key: XmlName<'_>, value: &T, ) -> Result<(), DeError>
Writes value
as an attribute
Sourcefn write_element<T>(&mut self, key: &str, value: &T) -> Result<(), DeError>
fn write_element<T>(&mut self, key: &str, value: &T) -> Result<(), DeError>
Writes value
either as a text content, or as an element.
If key
has a magic value TEXT_KEY
, then value
serialized as a
simple type.
If key
has a magic value VALUE_KEY
, then value
serialized as a
content without wrapping in tags, otherwise it is wrapped in
<${key}>...</${key}>
.
Trait Implementations§
Source§impl<'w, 'k, W: Write> SerializeStruct for Struct<'w, 'k, W>
impl<'w, 'k, W: Write> SerializeStruct for Struct<'w, 'k, W>
Auto Trait Implementations§
impl<'w, 'k, W> Freeze for Struct<'w, 'k, W>
impl<'w, 'k, W> RefUnwindSafe for Struct<'w, 'k, W>where
W: RefUnwindSafe,
impl<'w, 'k, W> Send for Struct<'w, 'k, W>where
W: Send,
impl<'w, 'k, W> Sync for Struct<'w, 'k, W>where
W: Sync,
impl<'w, 'k, W> Unpin for Struct<'w, 'k, W>
impl<'w, 'k, W> !UnwindSafe for Struct<'w, 'k, W>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more