Struct style_traits::values::SequenceWriter
source · pub struct SequenceWriter<'a, 'b: 'a, W: 'b> {
inner: &'a mut CssWriter<'b, W>,
separator: &'static str,
}
Expand description
Convenience wrapper to serialise CSS values separated by a given string.
Fields§
§inner: &'a mut CssWriter<'b, W>
§separator: &'static str
Implementations§
source§impl<'a, 'b, W> SequenceWriter<'a, 'b, W>where
W: Write + 'b,
impl<'a, 'b, W> SequenceWriter<'a, 'b, W>where
W: Write + 'b,
sourcepub fn new(inner: &'a mut CssWriter<'b, W>, separator: &'static str) -> Self
pub fn new(inner: &'a mut CssWriter<'b, W>, separator: &'static str) -> Self
Create a new sequence writer.
sourcepub fn write_item<F>(&mut self, f: F) -> Result
pub fn write_item<F>(&mut self, f: F) -> Result
Serialize the CSS Value with the specific serialization function.
sourcepub fn item<T>(&mut self, item: &T) -> Resultwhere
T: ToCss,
pub fn item<T>(&mut self, item: &T) -> Resultwhere
T: ToCss,
Serialises a CSS value, writing any separator as necessary.
The separator is never written before any item
produces any output,
and is written in subsequent calls only if the item
produces some
output on its own again. This lets us handle Option<T>
fields by
just not printing anything on None
.
Auto Trait Implementations§
impl<'a, 'b, W> Freeze for SequenceWriter<'a, 'b, W>
impl<'a, 'b, W> RefUnwindSafe for SequenceWriter<'a, 'b, W>where
W: RefUnwindSafe,
impl<'a, 'b, W> Send for SequenceWriter<'a, 'b, W>where
W: Send,
impl<'a, 'b, W> Sync for SequenceWriter<'a, 'b, W>where
W: Sync,
impl<'a, 'b, W> Unpin for SequenceWriter<'a, 'b, W>
impl<'a, 'b, W> !UnwindSafe for SequenceWriter<'a, 'b, 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