Enum kvarn::comprash::CachePreferenceError
source · pub enum CachePreferenceError {
Empty,
Invalid,
ZeroDuration,
}
Expand description
Error in parsing cache preference.
§Examples
comprash::ClientCachePreference};
assert_eq!(Err(CachePreferenceError::Empty), "".parse::<ServerCachePreference>());
assert_eq!(Err(CachePreferenceError::Invalid), "FULL".parse::<ClientCachePreference>());
assert_eq!(Ok(ServerCachePreference::QueryMatters), "query-matters".parse());
use std::convert::TryInto;
assert_eq!(Ok(ClientCachePreference::MaxAge(Duration::from_secs(42))), "42s".parse());
assert_eq!(Ok(ServerCachePreference::MaxAge(Duration::from_secs(3600))), "3600s".parse());
assert_eq!(Err(CachePreferenceError::ZeroDuration), "0s".parse::<ClientCachePreference>());
assert_eq!(Err(CachePreferenceError::ZeroDuration), "0s".parse::<ServerCachePreference>());
Variants§
Empty
Input string is empty.
Invalid
Input string has an invalid syntax.
ZeroDuration
Duration is zero
Trait Implementations§
source§impl Clone for CachePreferenceError
impl Clone for CachePreferenceError
source§fn clone(&self) -> CachePreferenceError
fn clone(&self) -> CachePreferenceError
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for CachePreferenceError
impl Debug for CachePreferenceError
source§impl Hash for CachePreferenceError
impl Hash for CachePreferenceError
source§impl PartialEq for CachePreferenceError
impl PartialEq for CachePreferenceError
source§fn eq(&self, other: &CachePreferenceError) -> bool
fn eq(&self, other: &CachePreferenceError) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for CachePreferenceError
impl Eq for CachePreferenceError
impl StructuralPartialEq for CachePreferenceError
Auto Trait Implementations§
impl Freeze for CachePreferenceError
impl RefUnwindSafe for CachePreferenceError
impl Send for CachePreferenceError
impl Sync for CachePreferenceError
impl Unpin for CachePreferenceError
impl UnwindSafe for CachePreferenceError
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.