[][src]Trait linkcheck::validation::Context

pub trait Context {
    pub fn client(&self) -> &Client;
pub fn filesystem_options(&self) -> &Options; pub fn url_specific_headers(&self, _url: &Url) -> HeaderMap { ... }
pub fn cache(&self) -> Option<MutexGuard<'_, Cache>> { ... }
pub fn concurrency(&self) -> usize { ... }
pub fn cache_timeout(&self) -> Duration { ... }
pub fn should_ignore(&self, _link: &Link) -> bool { ... } }

Contextual information that callers can provide to guide the validation process.

Required methods

pub fn client(&self) -> &Client[src]

The HTTP client to use.

pub fn filesystem_options(&self) -> &Options[src]

Options to use when checking a link on the filesystem.

Loading content...

Provided methods

pub fn url_specific_headers(&self, _url: &Url) -> HeaderMap[src]

Get any extra headers that should be sent when checking this Url.

pub fn cache(&self) -> Option<MutexGuard<'_, Cache>>[src]

An optional cache that can be used to avoid unnecessary network requests.

We need to use internal mutability here because validation is done concurrently. This MutexGuard is guaranteed to be short lived (just the duration of a Cache::insert() or Cache::lookup()), so it's okay to use a std::sync::Mutex instead of futures::lock::Mutex.

pub fn concurrency(&self) -> usize[src]

How many items should we check at a time?

pub fn cache_timeout(&self) -> Duration[src]

How long should a cached item be considered valid for before we need to check again?

pub fn should_ignore(&self, _link: &Link) -> bool[src]

Should this Link be skipped?

Loading content...

Implementors

impl Context for BasicContext[src]

Loading content...