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>());