[−][src]Struct cached_path::Meta
Holds information about a cached resource.
Fields
resource: String
The original resource name.
resource_path: PathBuf
Path to the cached resource.
meta_path: PathBuf
Path to the serialized meta.
etag: Option<String>
The ETAG of the resource from the time it was cached, if there was one.
expires: Option<f64>
Time that the freshness of this cached resource will expire.
creation_time: f64
Time this version of the resource was cached.
Implementations
impl Meta
[src]
pub async fn from_cache<'_>(resource_path: &'_ Path) -> Result<Self, Error>
[src]
Get the Meta
from a cached resource.
Examples
use cached_path::{cached_path, Meta}; let resource = "https://github.com/epwalsh/rust-cached-path/blob/master/README.md"; let path = cached_path(resource).await?; let meta = Meta::from_cache(&path).await?; assert_eq!(&meta.resource[..], resource);
pub fn is_fresh(&self, freshness_lifetime: Option<u64>) -> bool
[src]
Check if resource is still fresh. Passing a Some
value for
freshness_lifetime
will override the expiration time (if there is one)
of this resource.
Trait Implementations
impl Debug for Meta
[src]
impl<'de> Deserialize<'de> for Meta
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl PartialEq<Meta> for Meta
[src]
impl Serialize for Meta
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralPartialEq for Meta
[src]
Auto Trait Implementations
impl RefUnwindSafe for Meta
impl Send for Meta
impl Sync for Meta
impl Unpin for Meta
impl UnwindSafe for Meta
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,