pub struct Writer<'s, S: Sink> { /* private fields */ }Expand description
Writes Cache-Control directives, separated by , .
Delta-seconds are always written as tokens (senders must not quote them); field lists are always quoted.
Implementations§
Source§impl<'s, S: Sink> Writer<'s, S>
impl<'s, S: Sink> Writer<'s, S>
Sourcepub fn flag(&mut self, name: &str) -> Result<&mut Self, WriteError>
pub fn flag(&mut self, name: &str) -> Result<&mut Self, WriteError>
Writes a directive with no argument (no-store).
§Errors
WriteError::NotToken; WriteError::Full (nothing written for
this directive when the sink reports its room).
Sourcepub fn fields(
&mut self,
name: &str,
fields: &[&str],
) -> Result<&mut Self, WriteError>
pub fn fields( &mut self, name: &str, fields: &[&str], ) -> Result<&mut Self, WriteError>
Writes name="field, field" (no-cache="Set-Cookie").
§Errors
WriteError::NotToken for the name or a field name, and as
flag.
§Examples
use parse_net::{cache::Writer, SliceSink};
let mut buf = [0u8; 64];
let mut out = SliceSink::new(&mut buf);
Writer::new(&mut out).fields("no-cache", &["Set-Cookie", "Authorization"]).expect("room");
assert_eq!(out.written(), b"no-cache=\"Set-Cookie, Authorization\"");Auto Trait Implementations§
impl<'s, S> !UnwindSafe for Writer<'s, S>
impl<'s, S> Freeze for Writer<'s, S>
impl<'s, S> RefUnwindSafe for Writer<'s, S>where
&'s mut S: RefUnwindSafe,
impl<'s, S> Send for Writer<'s, S>
impl<'s, S> Sync for Writer<'s, S>
impl<'s, S> Unpin for Writer<'s, S>
impl<'s, S> UnsafeUnpin for Writer<'s, S>where
&'s mut S: UnsafeUnpin,
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