pub struct Request { /* private fields */ }Expand description
An incoming request: its URL, headers, cookies, input, uploaded files, session, and route.
As a handler argument, Request reads the body before the handler runs, so the body input is
ready right away. Because it reads the body, Request must be the handler’s last argument.
Reading the body fails as load_input does, and the error becomes the
response.
You read body input as a type with validate, parse, or
json, and read query string parameters with query, so a
handler sees only the input the type describes and query parameters never bleed into form or
JSON bodies. Uploaded files arrive as UploadedFile fields of a validated type:
#[derive(serde::Deserialize)]
struct Signup {
name: Option<String>,
#[serde(default)]
subscribe: bool,
}
async fn store(request: laravel::http::Request) -> laravel::Result<String> {
let signup: Signup = request.parse()?;
let name = signup.name.as_deref().unwrap_or("stranger");
Ok(format!("Hello, {name}! Subscribed: {}", signup.subscribe))
}Middleware receive a Request too. In middleware, the body input is empty until something
reads the body with load_input. Later middleware and the handler see the
input as each middleware leaves it.
To change the input whenever it’s read, without reading the body yourself, use
transform_input, as
TrimStrings does.
Implementations§
Source§impl Request
impl Request
Sourcepub async fn user<U>(&self) -> Result<Option<U>, Error>where
U: Authenticatable,
pub async fn user<U>(&self) -> Result<Option<U>, Error>where
U: Authenticatable,
The logged-in user, or None for a guest. This is the user that Auth
returns. The request loads the user once, so you get the same user here, through Auth,
and through Authenticated:
let user: Option<User> = request.user().await?;§Errors
Fails as Auth::user does, or when no guard authenticates U.
Sourcepub async fn authenticated(&self) -> Result<bool, Error>
pub async fn authenticated(&self) -> Result<bool, Error>
Whether a user is logged in, either through a request guard
or through the session guard. Unlike user, authenticated doesn’t need the
user’s type.
if request.authenticated().await? {
// ...
}§Errors
Fails when the session guard can’t load the user, such as when its provider’s query fails.
Sourcepub async fn can<U, Args, M>(
&self,
ability: impl Ability<U, Args, M>,
args: Args,
) -> Result<bool, Error>where
U: Authenticatable,
Args: Send,
pub async fn can<U, Args, M>(
&self,
ability: impl Ability<U, Args, M>,
args: Args,
) -> Result<bool, Error>where
U: Authenticatable,
Args: Send,
Whether the policy method allows the request’s user to perform the action, checked the way
Authorizable::can checks it. A guest is denied unless
the method takes an Option<&User>.
let allowed = request.can(PostPolicy::create, ()).await?;§Errors
Fails when user fails or the policy method fails.
Returns Ok when the policy method allows the request’s user to perform the action, as
Authorizable::authorize does. A guest gets a
403 unless the method takes an Option<&User>.
§Errors
Returns the denial’s HTTP error when the policy denies the action. Also fails when
user fails or the policy method fails.
Source§impl Request
impl Request
Sourcepub fn from_http(request: Request<Body>) -> Request
pub fn from_http(request: Request<Body>) -> Request
Wrap a request from the http crate. If middleware already read input from the body, that
input comes along too.
Sourcepub fn into_http(self) -> Request<Body>
pub fn into_http(self) -> Request<Body>
Unwrap into a request from the http crate. Input already read from the body stays with
the request, so a later from_http doesn’t read the body again.
Sourcepub async fn load_input(&mut self) -> Result<(), Error>
pub async fn load_input(&mut self) -> Result<(), Error>
Read the body’s JSON or form input, and make a multipart form’s files available to
validate. Once the body is read, later calls do nothing.
§Errors
Fails with 413 Content Too Large when the body is larger than its
LimitBody, which defaults to 2 MB. It also fails
with 413 in three cases: a multipart form is larger than its
LimitUploads, which defaults to 16 MB, the form’s
text fields together are larger than the LimitBody, or the form has more fields or files
than the server config section allows. It fails with 400 Bad Request when the body
can’t be read or isn’t valid for its content type.
Sourcepub fn transform_input(
&mut self,
transform: impl Fn(&mut Map<String, Value>) + Send + Sync + 'static,
)
pub fn transform_input( &mut self, transform: impl Fn(&mut Map<String, Value>) + Send + Sync + 'static, )
Transform the input now, and any body input read later, without reading the body first.
use laravel::http::{Middleware, Next, Request, Response};
use serde_json::Value;
struct LowercaseEmails;
impl Middleware for LowercaseEmails {
async fn handle(&self, mut request: Request, next: Next) -> laravel::Result<Response> {
request.transform_input(|input| {
if let Some(Value::String(email)) = input.get_mut("email") {
*email = email.to_lowercase();
}
});
Ok(next.run(request).await)
}
}Transforms run in the order you add them, so the middleware that runs first transforms the
input first. Transforms also apply to query.
Sourcepub fn uri(&self) -> &Uri
pub fn uri(&self) -> &Uri
The URI as the client sent it, before routing strips a nested router’s prefix.
Sourcepub fn url(&self) -> String
pub fn url(&self) -> String
The URL without the query string, such as https://example.com/users.
Sourcepub fn full_url(&self) -> String
pub fn full_url(&self) -> String
The URL with the query string, such as https://example.com/users?page=2.
Sourcepub fn origin(&self) -> String
pub fn origin(&self) -> String
The scheme and host the request was made to, with any port, such as
https://example.com. Behind a trusted proxy, they come from the proxy’s forwarded headers.
Sourcepub fn host(&self) -> String
pub fn host(&self) -> String
The host the request was made to, without its port, such as example.com. Behind a trusted
proxy, it comes from the proxy’s forwarded headers.
Sourcepub fn is_secure(&self) -> bool
pub fn is_secure(&self) -> bool
Whether the request was made over HTTPS. Behind a trusted proxy, the proxy’s forwarded headers decide.
Sourcepub fn full_url_with_query<I, K, V>(&self, query: I) -> String
pub fn full_url_with_query<I, K, V>(&self, query: I) -> String
The full URL with the given query parameters added, replacing any parameters with the same names. Use it for links that change one parameter of the current page:
let sorted_by_name = request.full_url_with_query([("sort", "name")]);Replacing a list parameter such as tags also removes tags[] and tags[0].
Sourcepub fn full_url_without_query<'a>(
&self,
names: impl IntoIterator<Item = &'a str>,
) -> String
pub fn full_url_without_query<'a>( &self, names: impl IntoIterator<Item = &'a str>, ) -> String
The full URL without the given query parameters. Use it for links that clear part of the current page’s query, such as the page number when a filter changes:
let first_page = request.full_url_without_query(["page"]);Sourcepub fn resembles(&self, pattern: &str) -> bool
pub fn resembles(&self, pattern: &str) -> bool
Whether the path matches a pattern, where * is a wildcard, as in
request.resembles("admin/*"). Leading and trailing slashes don’t matter.
Sourcepub fn header(&self, name: impl AsHeaderName) -> Option<&str>
pub fn header(&self, name: impl AsHeaderName) -> Option<&str>
The value of a request header. When the header has several values, this returns the first.
Returns None when the header is missing or its value isn’t visible ASCII.
Sourcepub const fn headers_mut(&mut self) -> &mut HeaderMap
pub const fn headers_mut(&mut self) -> &mut HeaderMap
All request headers, mutably, so you can change them for the rest of the request.
Sourcepub fn bearer_token(&self) -> Option<&str>
pub fn bearer_token(&self) -> Option<&str>
The token from an Authorization: Bearer header, with the scheme matched in any letter
case. Returns None when there’s no such header or the token is empty.
Sourcepub fn ip(&self) -> IpAddr
pub fn ip(&self) -> IpAddr
The client’s IP address. Behind a trusted proxy, it’s the address the proxy reports. Otherwise, it’s the address of the peer the server is connected to.
An IPv4 address stays IPv4, even when a server listening on :: sees it as an IPv6 address
such as ::ffff:203.0.113.5. When the server doesn’t know the peer, such as for a request
built by hand, the address is 0.0.0.0.
A cookie’s value as the browser sent it. On routes in the web group, the value is already
decrypted, and a value that fails to decrypt is None. Cookies you attach to a response
don’t change the values the request returns.
Sourcepub fn ajax(&self) -> bool
pub fn ajax(&self) -> bool
Whether the request’s X-Requested-With header marks it as an XMLHttpRequest.
Sourcepub fn prefetch(&self) -> bool
pub fn prefetch(&self) -> bool
Whether the browser is prefetching the page. A request is a prefetch when its Purpose,
Sec-Purpose, or X-Moz header is prefetch, in any letter case. This includes
prerender requests with Sec-Purpose: prefetch;prerender.
Sourcepub fn wants_json(&self) -> bool
pub fn wants_json(&self) -> bool
Whether the most preferred type in the Accept header is JSON, such as application/json
or application/vnd.api+json.
Sourcepub fn acceptable_types(&self) -> Vec<String>
pub fn acceptable_types(&self) -> Vec<String>
The content types that the Accept header lists, lowercased and sorted by quality value
with the most preferred first. Types that the header rules out with q=0 are left out.
Sourcepub fn accepts(&self, types: &[&str]) -> bool
pub fn accepts(&self, types: &[&str]) -> bool
Whether the client accepts any of the given content types. Each type may be a full type,
such as "text/csv", or a short name, such as "csv". A request without an Accept
header accepts anything.
Sourcepub fn prefers<'a>(&self, types: &[&'a str]) -> Option<&'a str>
pub fn prefers<'a>(&self, types: &[&'a str]) -> Option<&'a str>
The type that the client’s Accept header prefers among the given content types. Use it
to respond in the format the client asks for, such as Markdown for an agent:
use laravel::http::{IntoResponse, Response};
match request.prefers(&["text/html", "text/markdown"]) {
Some("text/markdown") => Ok(markdown().with_header("content-type", "text/markdown")),
_ => Ok(Response::new(laravel::view::view("page", ()))),
}A type may be a short name, such as "json". A client that asks for a more specific
version of a type, such as application/vnd.api+json for "json", prefers that type. A
client whose most preferred type is */* prefers the first type you list. Returns None
when the client accepts none of the types or sent no Accept header.
Sourcepub fn id(&self) -> Option<&str>
pub fn id(&self) -> Option<&str>
The request’s ID, which every log line written while handling the request carries. Returns
None for a request that didn’t pass through the application, such as one built by hand.
To learn where the ID comes from, check out RequestId.
Sourcepub fn extension<T>(&self) -> Option<&T>
pub fn extension<T>(&self) -> Option<&T>
A value from the request extensions by its type, such as one an earlier middleware added.
Sourcepub const fn extensions_mut(&mut self) -> &mut Extensions
pub const fn extensions_mut(&mut self) -> &mut Extensions
The request extensions, to add values that later middleware and the handler can read.
Sourcepub const fn content(&self) -> Option<&Bytes>
pub const fn content(&self) -> Option<&Bytes>
The body exactly as the client sent it. Use it to check a signature computed over the original bytes, or to read a body that isn’t a form or JSON:
use laravel::OrAbort;
async fn stripe_webhook(request: laravel::http::Request) -> laravel::Result<&'static str> {
let signature = request.header("stripe-signature").or_abort(400)?;
verify(request.content().or_abort(400)?, signature)?;
Ok("received")
}Like the input, the body is read before a handler runs, and in middleware once the
middleware calls load_input. Until then, content returns None.
It also returns None for a multipart body, because a multipart form’s files are written
to disk rather than kept in memory.
Source§impl Request
impl Request
Sourcepub fn expects_json(&self) -> bool
pub fn expects_json(&self) -> bool
Whether the client expects a JSON response. That’s the case when the request is for a
route in the api group, when the client asked for JSON, or when it made an
XMLHttpRequest that prefers no type in particular, such as with Accept: */*.
Sourcepub fn current_route(&self) -> Option<&CurrentRoute>
pub fn current_route(&self) -> Option<&CurrentRoute>
The matched route, once the request has been routed. Returns None before routing, such as
in global middleware, or when no route matched.
if let Some(route) = request.current_route() {
let uri = route.uri();
let domain = route.domain();
}Sourcepub fn route_is<H, T>(&self, handler: H) -> boolwhere
H: RouteHandler<T>,
pub fn route_is<H, T>(&self, handler: H) -> boolwhere
H: RouteHandler<T>,
Whether the matched route’s handler is the given handler, as in route_is(users::show).
Returns false before routing. To match several routes, match their paths with
resembles.
Sourcepub fn route(&self, name: &str) -> Option<&str>
pub fn route(&self, name: &str) -> Option<&str>
A domain or path parameter of the matched route, such as user in /users/{user}. Returns
None when the parameter is absent or no route has matched.
let account = request.route("account");
let user = request.route("user");Sourcepub fn route_as<T>(&self, name: &str) -> Result<T, Error>where
T: DeserializeOwned,
pub fn route_as<T>(&self, name: &str) -> Result<T, Error>where
T: DeserializeOwned,
A domain or path parameter of the matched route, parsed into a type, as
Params parses a handler’s parameters.
let team: i64 = request.route_as("team")?;
let month: Option<u8> = request.route_as("month")?;Read an optional parameter as an Option, which is None when the parameter is absent.
§Errors
Fails with a 404 when the parameter doesn’t parse, such as /teams/laravel for an i64,
because the URL names no such page. Fails with a 500 when no route has matched, or when
the route has no such parameter and T isn’t an Option.
Sourcepub async fn model<T>(&self, name: &str) -> Result<T, Error>where
T: RouteModel,
pub async fn model<T>(&self, name: &str) -> Result<T, Error>where
T: RouteModel,
The record that a route parameter names, found with its
RouteModel implementation:
let post: Post = request.model("post").await?;The request finds each record once, so a later model call or
Bound argument for the same parameter gets a copy without another
lookup.
§Errors
Fails with a 404 when the parameter doesn’t parse as the key, or when no record has the
key. Fails with a 500 when the route has no such parameter, and with the lookup’s error
when the record can’t be looked up.
§Panics
Panics outside an application context, as laravel::once does.
Sourcepub fn has_valid_signature(&self) -> bool
pub fn has_valid_signature(&self) -> bool
Whether the application signed the request’s URL, and the signature hasn’t expired.
Source§impl Request
impl Request
Sourcepub fn session(&self) -> Result<&Session, Error>
pub fn session(&self) -> Result<&Session, Error>
The request’s session, available on routes in the web group:
use laravel::http::{Redirect, Request};
async fn store(request: Request) -> laravel::Result<Redirect> {
request.session()?.flash("status", "Saved!");
Ok(Redirect::back())
}§Errors
Fails with a 500 when the request has no session. Only routes in the web group have a
session, which StartSession starts. Global middleware run
before the session starts, so they don’t see it either.
Sourcepub fn old<T>(&self, path: &str) -> Option<T>where
T: DeserializeOwned,
pub fn old<T>(&self, path: &str) -> Option<T>where
T: DeserializeOwned,
The input flashed for this request by a previous form submission, by dot-notation path.
Reading the input doesn’t consume it. Returns None when the field was absent, its value
isn’t a T, or this request has no session.
let name: Option<String> = request.old("name");
let tags = request.old::<Vec<String>>("tags").unwrap_or_default();Source§impl Request
impl Request
Sourcepub fn json<T>(&self) -> Result<T, Error>where
T: DeserializeOwned,
pub fn json<T>(&self) -> Result<T, Error>where
T: DeserializeOwned,
Returns the JSON body deserialized into a type, whatever its shape: an object, a list such as a batch of items, or a single value. Request input holds only objects, so a handler reads a list or a single value with this method.
async fn import(request: laravel::http::Request) -> laravel::Result<String> {
let items: Vec<Item> = request.json()?;
Ok(format!("{} items", items.len()))
}§Errors
Returns a 400 error when the body isn’t JSON or is a multipart form. Like
parse, returns a 422 error that names the field when the body doesn’t fit
the type. In middleware that hasn’t read the body with load_input,
returns a 500 error.
Sourcepub fn validate<T>(
&self,
) -> impl Future<Output = Result<T, ValidationError>> + Sendwhere
T: DeserializeOwned + ValidatesRequest,
pub fn validate<T>(
&self,
) -> impl Future<Output = Result<T, ValidationError>> + Sendwhere
T: DeserializeOwned + ValidatesRequest,
Decodes and validates the request’s input with the rules declared on T.
First, T’s authorize runs. Then validation uses the
rules that T’s rules returns. The error lists both rule
errors and decoding errors, even when one field’s error prevents the type from being
constructed.
§Errors
Returns ValidationError::Invalid when fields don’t pass. As a response, that error is a
422 for JSON and API requests. A browser request with a session gets a redirect back with
the errors and old input, without passwords.
Returns ValidationError::Failed with a 403 when authorize returns false. It also
returns Failed with the error of authorize, rules, or an async rule that couldn’t run.
Match Invalid to render the form yourself, or propagate the error with ? for the
standard responses.
#[derive(serde::Deserialize, laravel::validation::Validate)]
#[validate(anyone)]
struct StorePost {
#[validate(bail, required, max_length = 255)]
title: String,
}
let post: StorePost = request.validate().await?;Sourcepub fn validate_with<'a, T>(
&'a self,
rules: impl FnOnce(Rules) -> Rules + Send + 'a,
) -> impl Future<Output = Result<T, ValidationError>> + Send + 'awhere
T: DeserializeOwned + ValidatesRequest,
pub fn validate_with<'a, T>(
&'a self,
rules: impl FnOnce(Rules) -> Rules + Send + 'a,
) -> impl Future<Output = Result<T, ValidationError>> + Send + 'awhere
T: DeserializeOwned + ValidatesRequest,
Decodes and validates input with the rules declared on T, plus rules that the handler
adds.
Use this when a rule needs a value that only the handler has, such as the ID of the record
being updated. The closure receives T’s rules and returns the rules to validate with. Added
rules run after the field’s declared rules.
§Errors
Returns the same errors as validate, with the same responses.
use laravel::validation::{DatabaseRules, Rule, Validate};
#[derive(serde::Deserialize, Validate)]
#[validate(anyone)]
struct UpdateTeam {
#[validate(required, max_length = 255)]
name: String,
}
let team: UpdateTeam = request
.validate_with(|rules| {
rules.field("name", [Rule::unique_in::<String>("teams", "name").ignore(team_id)])
})
.await?;Sourcepub fn parse<T>(&self) -> Result<T, Error>where
T: DeserializeOwned,
pub fn parse<T>(&self) -> Result<T, Error>where
T: DeserializeOwned,
Deserializes all of the request’s non-file input into a type.
Forms send every value as text, so numbers and booleans are parsed from the text. For
example, age=42 reads as a u32, and a checked checkbox’s on reads as true.
Nested fields such as address[city] or items[0][sku] deserialize into nested structs
and lists. A list holds its entries in index order, even when the form sends items[1]
before items[0]. A null field counts as missing unless its type is an Option.
§Errors
Returns an InvalidInput error, a 422 Unprocessable Content, that names each field
that doesn’t match the type. For example, a missing email field gets the message “The
email field is required.” The error names at most 1,000 fields. For input of more than
about a thousand values, it names only the first missing fields.
Sourcepub async fn query<T>(&self) -> Result<T, Error>where
T: DeserializeOwned + QueryInput,
pub async fn query<T>(&self) -> Result<T, Error>where
T: DeserializeOwned + QueryInput,
Deserializes and validates the query string alone into a QueryInput type, ignoring the
body, so a body field can’t stand in for a query parameter. Values are parsed from text as
parse parses them, and input middleware such as TrimStrings and
ConvertEmptyStringsToNull apply.
Mark the struct with #[laravel::query]. Fields with a fallback (Option<T>,
#[default], #[default = expr], or #[serde(default)]) are lenient: missing, blank
(?q=), or invalid (?page=abc) values fall back to None or their default. Fields
without a fallback are required.
#[laravel::query]
struct Search {
#[default]
q: String,
#[default = 1]
page: u32,
}
let search: Search = request.query().await?;§Errors
Returns a 400 Bad Request wrapping an InvalidInput when a required parameter (one
without Option or a default) is missing, blank, or invalid, or when so many fields fail
that validation stops early. API clients receive a 400 JSON response with the field
errors, and browsers receive a 400 error page rather than a redirect. Any operational
failure from an async validation rule (such as a database outage) is returned with its
original error.
Trait Implementations§
Source§impl Debug for Request
Shows the request without its credentials. It redacts the Cookie, Authorization, and
Proxy-Authorization headers and every password field, and it shows the query string only as
part of the input. The password fields are the ones named password, password_confirmation,
or current_password, plus the Password fields of any input type
that validated the request, along with their confirmations.
impl Debug for Request
Shows the request without its credentials. It redacts the Cookie, Authorization, and
Proxy-Authorization headers and every password field, and it shows the query string only as
part of the input. The password fields are the ones named password, password_confirmation,
or current_password, plus the Password fields of any input type
that validated the request, along with their confirmations.
Source§impl<S> FromRequest<S> for Request
impl<S> FromRequest<S> for Request
Auto Trait Implementations§
impl !Freeze for Request
impl !RefUnwindSafe for Request
impl !UnwindSafe for Request
impl Forget for Request
impl Move for Request
impl Send for Requestwhere
BoxRaw<[u8]>: Send,
BoxRaw<ByteStr>: Send,
Bytes: Send,
BoxRaw<[Pos]>: Send,
RawVecInner: Send,
BoxRaw<HashMap<TypeId, Box<dyn AnyClone + Sync + Send>, BuildHasherDefault<IdHasher>>>: Send,
BoxRaw<dyn Body<Error = Error, Data = Bytes> + Send>: Send,
Arc<IndexMap<String, InputValue>>: Send,
Mutex<Vec<Vec<String>>>: Send,
impl Sync for Request
impl Unpin for Requestwhere
Box<[u8]>: Unpin,
Box<ByteStr>: Unpin,
*const u8: Unpin,
Align8<*mut ()>: Unpin,
&'static Vtable: Unpin,
Box<[Pos]>: Unpin,
*const u8 is !null: Unpin,
Box<HashMap<TypeId, Box<dyn AnyClone + Sync + Send>, BuildHasherDefault<IdHasher>>>: Unpin,
Box<dyn Body<Error = Error, Data = Bytes> + Send>: Unpin,
Arc<IndexMap<String, InputValue>>: Unpin,
Align4<u32>: Unpin,
Align1<u8>: Unpin,
impl UnsafeUnpin for Requestwhere
*const [u8] is !null: UnsafeUnpin,
PhantomData<[u8]>: UnsafeUnpin,
*const ByteStr is !null: UnsafeUnpin,
PhantomData<ByteStr>: UnsafeUnpin,
*const u8: UnsafeUnpin,
Align8<*mut ()>: UnsafeUnpin,
&'static Vtable: UnsafeUnpin,
*const [Pos] is !null: UnsafeUnpin,
PhantomData<[Pos]>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<Bucket<HeaderValue>>: UnsafeUnpin,
PhantomData<ExtraValue<HeaderValue>>: UnsafeUnpin,
*const HashMap<TypeId, Box<dyn AnyClone + Sync + Send>, BuildHasherDefault<IdHasher>> is !null: UnsafeUnpin,
PhantomData<HashMap<TypeId, Box<dyn AnyClone + Sync + Send>, BuildHasherDefault<IdHasher>>>: UnsafeUnpin,
*const dyn Body<Error = Error, Data = Bytes> + Send is !null: UnsafeUnpin,
PhantomData<dyn Body<Error = Error, Data = Bytes> + Send>: UnsafeUnpin,
*const ArcInner<IndexMap<String, InputValue>> is !null: UnsafeUnpin,
PhantomData<ArcInner<IndexMap<String, InputValue>>>: UnsafeUnpin,
PhantomData<Vec<String>>: UnsafeUnpin,
Align4<u32>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<K> ForeignKey<K> for K
impl<K> ForeignKey<K> for K
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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