[][src]Struct cached_path::Meta

pub struct Meta {
    pub resource: String,
    pub resource_path: PathBuf,
    pub meta_path: PathBuf,
    pub etag: Option<String>,
    pub expires: Option<f64>,
    pub creation_time: f64,
}

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.

Methods

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) -> bool[src]

Check if resource is still fresh.

Trait Implementations

impl Debug for Meta[src]

impl<'de> Deserialize<'de> for Meta[src]

impl PartialEq<Meta> for Meta[src]

impl Serialize for Meta[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,