pub struct DirectiveValue(pub Vec<u8>);Expand description
Cache control directive value type
Tuple Fields§
§0: Vec<u8>Implementations§
Source§impl DirectiveValue
impl DirectiveValue
Sourcepub fn parse_as_bytes(&self) -> &[u8] ⓘ
pub fn parse_as_bytes(&self) -> &[u8] ⓘ
A DirectiveValue without quotes (").
Sourcepub fn parse_as_str(&self) -> Result<&str>
pub fn parse_as_str(&self) -> Result<&str>
A DirectiveValue without quotes (") as str.
Sourcepub fn parse_as_delta_seconds(&self) -> Result<u32>
pub fn parse_as_delta_seconds(&self) -> Result<u32>
Parse the DirectiveValue as delta seconds
"s are ignored. The value is capped to DELTA_SECONDS_OVERFLOW_VALUE.
Sourcepub fn parse_as_delta_seconds_floor(&self) -> Result<u32>
pub fn parse_as_delta_seconds_floor(&self) -> Result<u32>
Parse the DirectiveValue as delta seconds, permitting a fractional component.
Values with a fractional part are rounded down (floored) to the nearest
non-negative integer: e.g. 1.9 -> 1, 0.5 -> 0. This is useful
for compatibility with upstreams that emit fractional ttls (which
RFC 9111 strict integer parsing rejects).
Integer parsing is attempted first, so strictly-numeric values (including overflow-capped values and quoted integers) behave identically to Self::parse_as_delta_seconds. Negative, non-finite, or non-numeric values still return an error.
"s are ignored. The value is capped to DELTA_SECONDS_OVERFLOW_VALUE.
Trait Implementations§
Source§impl AsRef<[u8]> for DirectiveValue
impl AsRef<[u8]> for DirectiveValue
Auto Trait Implementations§
impl Freeze for DirectiveValue
impl RefUnwindSafe for DirectiveValue
impl Send for DirectiveValue
impl Sync for DirectiveValue
impl Unpin for DirectiveValue
impl UnsafeUnpin for DirectiveValue
impl UnwindSafe for DirectiveValue
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Upper case
letters are used (e.g. F9B4CA)