Struct lychee_lib::Client
source · pub struct Client { /* private fields */ }
Expand description
Handles incoming requests and returns responses.
See ClientBuilder
which contains sane defaults for all configuration
options.
Implementations§
source§impl Client
impl Client
sourcepub async fn check<T, E>(&self, request: T) -> Result<Response>
pub async fn check<T, E>(&self, request: T) -> Result<Response>
Check a single request.
request
can be either a Request
or a type that can be converted
into it. In any case, it must represent a valid URI.
§Errors
Returns an Err
if:
request
does not represent a valid URI.- Encrypted connection for a HTTP URL is available but unused. (Only
checked when
Client::require_https
istrue
.)
sourcepub fn remap(&self, uri: &mut Uri) -> Result<()>
pub fn remap(&self, uri: &mut Uri) -> Result<()>
Remap uri
using the client-defined remapping rules.
§Errors
Returns an Err
if the final, remapped uri
is not a valid URI.
sourcepub fn is_excluded(&self, uri: &Uri) -> bool
pub fn is_excluded(&self, uri: &Uri) -> bool
Returns whether the given uri
should be ignored from checking.
sourcepub async fn check_website(
&self,
uri: &Uri,
default_chain: RequestChain
) -> Result<Status>
pub async fn check_website( &self, uri: &Uri, default_chain: RequestChain ) -> Result<Status>
Checks the given URI of a website.
§Errors
This returns an Err
if
- The URI is invalid.
- The request failed.
- The response status code is not accepted.
- The URI cannot be converted to HTTPS.
sourcepub async fn check_website_inner(
&self,
uri: &Uri,
default_chain: &RequestChain
) -> Status
pub async fn check_website_inner( &self, uri: &Uri, default_chain: &RequestChain ) -> Status
Checks the given URI of a website.
Unsupported schemes will be ignored
§Errors
This returns an Err
if
- The URI is invalid.
- The request failed.
- The response status code is not accepted.
sourcepub async fn check_file(&self, uri: &Uri) -> Status
pub async fn check_file(&self, uri: &Uri) -> Status
Check a file
URI.
sourcepub async fn check_fragment(&self, path: &Path, uri: &Uri) -> Status
pub async fn check_fragment(&self, path: &Path, uri: &Uri) -> Status
Checks a file
URI’s fragment.
sourcepub async fn check_mail(&self, uri: &Uri) -> Status
pub async fn check_mail(&self, uri: &Uri) -> Status
Check a mail address, or equivalently a mailto
URI.
URIs may contain query parameters (e.g. contact@example.com?subject="Hello"
),
which are ignored by this check. The are not part of the mail address
and instead passed to a mail client.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more