Skip to main content

Request

Struct Request 

Source
pub struct Request<T = Body> { /* private fields */ }
Expand description

Represents an HTTP request.

An HTTP request consists of a head and a potentially optional body. The body component is generic, enabling arbitrary types to represent the HTTP body. For example, the body could be Vec<u8>, a Stream of byte chunks, or a value that has been deserialized.

§Examples

Creating a Request to send

use rama_http_types::{Request, Response};

let mut request = Request::builder()
    .uri("https://www.rust-lang.org/")
    .header("User-Agent", "my-awesome-agent/1.0");

if needs_awesome_header() {
    request = request.header("Awesome", "yes");
}

let response = send(request.body(()).unwrap());

fn send(req: Request<()>) -> Response<()> {
    // ...
}

Inspecting a request to see what was sent.

use rama_http_types::{Request, Response, Result, StatusCode};

fn respond_to(req: Request<()>) -> Result<Response<()>> {
    if req.uri().as_str() != "/awesome-url" {
        return Response::builder()
            .status(StatusCode::NOT_FOUND)
            .body(())
    }

    let has_awesome_header = req.headers().contains_key("Awesome");
    let body = req.body();

    // ...
}

Deserialize a request of bytes via json:

use rama_http_types::Request;
use serde::de;

fn deserialize<T>(req: Request<Vec<u8>>) -> serde_json::Result<Request<T>>
    where for<'de> T: de::Deserialize<'de>,
{
    let (parts, body) = req.into_parts();
    let body = serde_json::from_slice(&body)?;
    Ok(Request::from_parts(parts, body))
}

Or alternatively, serialize the body of a request to json

use rama_http_types::Request;
use serde::ser;

fn serialize<T>(req: Request<T>) -> serde_json::Result<Request<Vec<u8>>>
    where T: ser::Serialize,
{
    let (parts, body) = req.into_parts();
    let body = serde_json::to_vec(&body)?;
    Ok(Request::from_parts(parts, body))
}

Implementations§

Source§

impl Request<()>

Source

pub fn builder() -> Builder

Creates a new builder-style object to manufacture a Request

This method returns an instance of Builder which can be used to create a Request.

§Examples
let request = Request::builder()
    .method("GET")
    .uri("https://www.rust-lang.org/")
    .header("X-Custom-Foo", "Bar")
    .body(())
    .unwrap();
Source

pub fn builder_with_extensions(ext: Extensions) -> Builder

Same as Request::builder but with the given Extensions to start from.

Source

pub fn get<T>(uri: T) -> Builder
where T: TryInto<Uri>, <T as TryInto<Uri>>::Error: Into<Error>,

Creates a new Builder initialized with a GET method and the given URI.

This method returns an instance of Builder which can be used to create a Request.

§Example

let request = Request::get("https://www.rust-lang.org/")
    .body(())
    .unwrap();
Source

pub fn put<T>(uri: T) -> Builder
where T: TryInto<Uri>, <T as TryInto<Uri>>::Error: Into<Error>,

Creates a new Builder initialized with a PUT method and the given URI.

This method returns an instance of Builder which can be used to create a Request.

§Example

let request = Request::put("https://www.rust-lang.org/")
    .body(())
    .unwrap();
Source

pub fn post<T>(uri: T) -> Builder
where T: TryInto<Uri>, <T as TryInto<Uri>>::Error: Into<Error>,

Creates a new Builder initialized with a POST method and the given URI.

This method returns an instance of Builder which can be used to create a Request.

§Example

let request = Request::post("https://www.rust-lang.org/")
    .body(())
    .unwrap();
Source

pub fn delete<T>(uri: T) -> Builder
where T: TryInto<Uri>, <T as TryInto<Uri>>::Error: Into<Error>,

Creates a new Builder initialized with a DELETE method and the given URI.

This method returns an instance of Builder which can be used to create a Request.

§Example

let request = Request::delete("https://www.rust-lang.org/")
    .body(())
    .unwrap();
Source

pub fn options<T>(uri: T) -> Builder
where T: TryInto<Uri>, <T as TryInto<Uri>>::Error: Into<Error>,

Creates a new Builder initialized with an OPTIONS method and the given URI.

This method returns an instance of Builder which can be used to create a Request.

§Example

let request = Request::options("https://www.rust-lang.org/")
    .body(())
    .unwrap();
Source

pub fn head<T>(uri: T) -> Builder
where T: TryInto<Uri>, <T as TryInto<Uri>>::Error: Into<Error>,

Creates a new Builder initialized with a HEAD method and the given URI.

This method returns an instance of Builder which can be used to create a Request.

§Example

let request = Request::head("https://www.rust-lang.org/")
    .body(())
    .unwrap();
Source

pub fn connect<T>(uri: T) -> Builder
where T: TryInto<Uri>, <T as TryInto<Uri>>::Error: Into<Error>,

Creates a new Builder initialized with a CONNECT method and the given URI.

This method returns an instance of Builder which can be used to create a Request.

§Example

let request = Request::connect("https://www.rust-lang.org/")
    .body(())
    .unwrap();
Source

pub fn patch<T>(uri: T) -> Builder
where T: TryInto<Uri>, <T as TryInto<Uri>>::Error: Into<Error>,

Creates a new Builder initialized with a PATCH method and the given URI.

This method returns an instance of Builder which can be used to create a Request.

§Example

let request = Request::patch("https://www.rust-lang.org/")
    .body(())
    .unwrap();
Source

pub fn trace<T>(uri: T) -> Builder
where T: TryInto<Uri>, <T as TryInto<Uri>>::Error: Into<Error>,

Creates a new Builder initialized with a TRACE method and the given URI.

This method returns an instance of Builder which can be used to create a Request.

§Example

let request = Request::trace("https://www.rust-lang.org/")
    .body(())
    .unwrap();
Source

pub fn query<T>(uri: T) -> Builder
where T: TryInto<Uri>, <T as TryInto<Uri>>::Error: Into<Error>,

Creates a new Builder initialized with a QUERY method and the given URI.

QUERY (RFC 10008) is a safe, idempotent method whose request content defines the query; remember to set a Content-Type for the body.

This method returns an instance of Builder which can be used to create a Request.

§Example

let request = Request::query("https://www.rust-lang.org/")
    .body(())
    .unwrap();
Source§

impl<T> Request<T>

Source

pub fn new(body: T) -> Self

Creates a new blank Request with the body

The component parts of this request will be set to their default, e.g. the GET method, no headers, etc.

§Examples
let request = Request::new("hello world");

assert_eq!(*request.method(), Method::GET);
assert_eq!(*request.body(), "hello world");
Source

pub fn from_parts(parts: Parts, body: T) -> Self

Creates a new Request with the given components parts and body.

§Examples
let request = Request::new("hello world");
let (mut parts, body) = request.into_parts();
parts.method = Method::POST;

let request = Request::from_parts(parts, body);
Source

pub fn method(&self) -> &Method

Returns a reference to the associated HTTP method.

§Examples
let request: Request<()> = Request::default();
assert_eq!(*request.method(), Method::GET);
Source

pub fn method_mut(&mut self) -> &mut Method

Returns a mutable reference to the associated HTTP method.

§Examples
let mut request: Request<()> = Request::default();
*request.method_mut() = Method::PUT;
assert_eq!(*request.method(), Method::PUT);
Source

pub fn uri(&self) -> &Uri

Returns a reference to the associated URI.

§Examples
let request: Request<()> = Request::default();
assert_eq!(request.uri().as_str(), "/");
Source

pub fn request_uri(&self) -> Uri

Get the URI as complete as possible for this request.

Where uri returns the URI exactly as received (often origin-form /path for HTTP/1.1), this fills in the scheme and authority from the request’s effective protocol and authority (URI → TLS SNI → ForwardedHost header) — a derivation callers can treat as a technical detail.

Source

pub fn uri_mut(&mut self) -> &mut Uri

Returns a mutable reference to the associated URI.

§Examples
let mut request: Request<()> = Request::default();
*request.uri_mut() = "/hello".parse().unwrap();
assert_eq!(request.uri().as_str(), "/hello");
Source

pub fn version(&self) -> Version

Returns the associated version.

§Examples
let request: Request<()> = Request::default();
assert_eq!(request.version(), Version::HTTP_11);
Source

pub fn version_mut(&mut self) -> &mut Version

Returns a mutable reference to the associated version.

§Examples
let mut request: Request<()> = Request::default();
*request.version_mut() = Version::HTTP_2;
assert_eq!(request.version(), Version::HTTP_2);
Source

pub fn headers(&self) -> &HeaderMap<HeaderValue>

Returns a reference to the associated header field map.

§Examples
let request: Request<()> = Request::default();
assert!(request.headers().is_empty());
Source

pub fn headers_mut(&mut self) -> &mut HeaderMap<HeaderValue>

Returns a mutable reference to the associated header field map.

§Examples
let mut request: Request<()> = Request::default();
request.headers_mut().insert(HOST, HeaderValue::from_static("world"));
assert!(!request.headers().is_empty());
Source

pub fn clone_parts(&self) -> Parts

Returned a cloned of the associated HTTP header.

Source

pub fn body(&self) -> &T

Returns a reference to the associated HTTP body.

§Examples
let request: Request<String> = Request::default();
assert!(request.body().is_empty());
Source

pub fn body_mut(&mut self) -> &mut T

Returns a mutable reference to the associated HTTP body.

§Examples
let mut request: Request<String> = Request::default();
request.body_mut().push_str("hello world");
assert!(!request.body().is_empty());
Source

pub fn into_body(self) -> T

Consumes the request, returning just the body.

§Examples
let request = Request::new(10);
let body = request.into_body();
assert_eq!(body, 10);
Source

pub fn into_parts(self) -> (Parts, T)

Consumes the request returning the head and body parts.

§Examples
let request = Request::new(());
let (parts, body) = request.into_parts();
assert_eq!(parts.method, Method::GET);
Source

pub fn map<F, U>(self, f: F) -> Request<U>
where F: FnOnce(T) -> U,

Consumes the request returning a new request with body mapped to the return type of the passed in function.

§Examples
let request = Request::builder().body("some string").unwrap();
let mapped_request: Request<&[u8]> = request.map(|b| {
  assert_eq!(b, "some string");
  b.as_bytes()
});
assert_eq!(mapped_request.body(), &"some string".as_bytes());
Source

pub fn with_extensions(self, extensions: Extensions) -> Self

Source

pub fn set_extensions(&mut self, extensions: Extensions) -> &mut Self

Trait Implementations§

Source§

impl<Body> AuthorityInputExt for Request<Body>

Source§

fn authority(&self) -> Option<HostWithOptPort>

The routing authority (host[:port]), or None if none is resolvable.
Source§

fn host(&self) -> Option<Host>

The authority Host, dropping any port.
Source§

fn host_as_domain(&self) -> Option<Domain>

The authority host as a Domain, or None if absent or not a domain (e.g. an IP literal).
Source§

fn port(&self) -> Option<u16>

The authority port, if one is set explicitly.
Source§

impl<B: StreamingBody> Body for Request<B>

Source§

type Data = <B as Body>::Data

Values yielded by the Body.
Source§

type Error = <B as Body>::Error

The error type this Body might generate.
Source§

fn poll_frame( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Option<Result<Frame<Self::Data>, Self::Error>>>

Attempt to pull out the next frame of this stream. Read more
Source§

fn is_end_stream(&self) -> bool

A hint that may return true when the end of stream has been reached. Read more
Source§

fn size_hint(&self) -> SizeHint

A hint that returns the bounds on the remaining length of the stream. Read more
Source§

impl<Body> BodyExtractExt for Request<Body>
where Body: StreamingBody<Data = Bytes, Error: Into<BoxError>> + Send + Sync + 'static,

Source§

async fn try_into_json<T: DeserializeOwned + Send + 'static>( self, ) -> Result<T, BoxError>

Try to deserialize the (contained) body as a JSON object. Read more
Source§

async fn try_into_json_streaming<T: DeserializeOwned + Send + 'static>( self, ) -> Result<T, BoxError>

Try to deserialize the (contained) body as a JSON object, streaming bytes from the body directly into the JSON parser instead of buffering the whole body first. Read more
Source§

async fn try_into_string(self) -> Result<String, BoxError>

Try to turn the (contained) body in an utf-8 string.
Source§

async fn try_capture_json( self, selectors: impl IntoIterator<Item = JsonPath> + Send, max_capture_bytes: usize, ) -> Result<Vec<OwnedCapturedValue>, BoxError>

Capture JSON values matching selectors while streaming over the body. Read more
Source§

async fn try_into_json_with<T: DeserializeOwned + Send + 'static>( self, opts: CollectOptions, ) -> Result<T, CollectError>

Like try_into_json, but bounded by opts (a size cap and/or timeout). Read more
Source§

async fn try_into_string_with( self, opts: CollectOptions, ) -> Result<String, CollectError>

Like try_into_string, but bounded by opts. See try_into_json_with for the error semantics.
Source§

impl<B> ClientIp for Request<B>

Source§

fn client_ip(&self) -> Option<IpAddr>

Best-effort client IP — see client_ip for the common resolution.
Source§

impl<T: Clone> Clone for Request<T>

Source§

fn clone(&self) -> Request<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Request<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default> Default for Request<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<B> ExtensionsRef for Request<B>

Source§

fn extensions(&self) -> &Extensions

Get reference to the underlying Extensions store
Source§

impl<Body> HttpRequestParts for Request<Body>

Source§

fn method(&self) -> &Method

Source§

fn uri(&self) -> &Uri

Source§

fn version(&self) -> Version

Source§

fn headers(&self) -> &HeaderMap<HeaderValue>

Source§

impl<Body> HttpRequestPartsMut for Request<Body>

Source§

fn method_mut(&mut self) -> &mut Method

Source§

fn uri_mut(&mut self) -> &mut Uri

Source§

fn version_mut(&mut self) -> &mut Version

Source§

fn headers_mut(&mut self) -> &mut HeaderMap<HeaderValue>

Source§

impl<Body> HttpVersionInputExt for Request<Body>

Source§

fn http_version(&self) -> Option<Version>

The HTTP version, or None for non-HTTP inputs.
Source§

impl<Body> Matcher<Request<Body>> for SocketAddressMatcher

Source§

fn matches(&self, _ext: Option<&Extensions>, req: &Request<Body>) -> bool

returns true on a match, false otherwise Read more
Source§

fn or<M>(self, other: M) -> impl Matcher<Input>
where Self: Sized, M: Matcher<Input>,

Provide an alternative matcher to match if the current one does not match.
Source§

fn and<M>(self, other: M) -> impl Matcher<Input>
where Self: Sized, M: Matcher<Input>,

Add another condition to match on top of the current one.
Source§

fn not(self) -> impl Matcher<Input>
where Self: Sized,

Negate the current condition.
Source§

impl<Body> Matcher<Request<Body>> for IpNetMatcher

Source§

fn matches(&self, _ext: Option<&Extensions>, req: &Request<Body>) -> bool

returns true on a match, false otherwise Read more
Source§

fn or<M>(self, other: M) -> impl Matcher<Input>
where Self: Sized, M: Matcher<Input>,

Provide an alternative matcher to match if the current one does not match.
Source§

fn and<M>(self, other: M) -> impl Matcher<Input>
where Self: Sized, M: Matcher<Input>,

Add another condition to match on top of the current one.
Source§

fn not(self) -> impl Matcher<Input>
where Self: Sized,

Negate the current condition.
Source§

impl<Body> Matcher<Request<Body>> for LoopbackMatcher

Source§

fn matches(&self, _ext: Option<&Extensions>, req: &Request<Body>) -> bool

returns true on a match, false otherwise Read more
Source§

fn or<M>(self, other: M) -> impl Matcher<Input>
where Self: Sized, M: Matcher<Input>,

Provide an alternative matcher to match if the current one does not match.
Source§

fn and<M>(self, other: M) -> impl Matcher<Input>
where Self: Sized, M: Matcher<Input>,

Add another condition to match on top of the current one.
Source§

fn not(self) -> impl Matcher<Input>
where Self: Sized,

Negate the current condition.
Source§

impl<Body> Matcher<Request<Body>> for PortMatcher

Source§

fn matches(&self, _ext: Option<&Extensions>, req: &Request<Body>) -> bool

returns true on a match, false otherwise Read more
Source§

fn or<M>(self, other: M) -> impl Matcher<Input>
where Self: Sized, M: Matcher<Input>,

Provide an alternative matcher to match if the current one does not match.
Source§

fn and<M>(self, other: M) -> impl Matcher<Input>
where Self: Sized, M: Matcher<Input>,

Add another condition to match on top of the current one.
Source§

fn not(self) -> impl Matcher<Input>
where Self: Sized,

Negate the current condition.
Source§

impl<Body> Matcher<Request<Body>> for PrivateIpNetMatcher

Source§

fn matches(&self, _ext: Option<&Extensions>, req: &Request<Body>) -> bool

returns true on a match, false otherwise Read more
Source§

fn or<M>(self, other: M) -> impl Matcher<Input>
where Self: Sized, M: Matcher<Input>,

Provide an alternative matcher to match if the current one does not match.
Source§

fn and<M>(self, other: M) -> impl Matcher<Input>
where Self: Sized, M: Matcher<Input>,

Add another condition to match on top of the current one.
Source§

fn not(self) -> impl Matcher<Input>
where Self: Sized,

Negate the current condition.
Source§

impl<Body: 'static> Matcher<Request<Body>> for SocketMatcher<Request<Body>>

The composite SocketMatcher delegates to the leaf impls above (and any custom/nested matchers) through its public matches_input helper, so its All/Any/Custom/negation logic applies to an HTTP Request too.

Source§

fn matches(&self, ext: Option<&Extensions>, req: &Request<Body>) -> bool

returns true on a match, false otherwise Read more
Source§

fn or<M>(self, other: M) -> impl Matcher<Input>
where Self: Sized, M: Matcher<Input>,

Provide an alternative matcher to match if the current one does not match.
Source§

fn and<M>(self, other: M) -> impl Matcher<Input>
where Self: Sized, M: Matcher<Input>,

Add another condition to match on top of the current one.
Source§

fn not(self) -> impl Matcher<Input>
where Self: Sized,

Negate the current condition.
Source§

impl<Body> Matcher<Request<Body>> for HttpProxyConnectMatcher

Source§

fn matches(&self, _ext: Option<&Extensions>, req: &Request<Body>) -> bool

returns true on a match, false otherwise Read more
Source§

fn or<M>(self, other: M) -> impl Matcher<Input>
where Self: Sized, M: Matcher<Input>,

Provide an alternative matcher to match if the current one does not match.
Source§

fn and<M>(self, other: M) -> impl Matcher<Input>
where Self: Sized, M: Matcher<Input>,

Add another condition to match on top of the current one.
Source§

fn not(self) -> impl Matcher<Input>
where Self: Sized,

Negate the current condition.
Source§

impl<Body> PathInputExt for Request<Body>

Source§

fn path_ref(&self) -> PathRef<'_>

The path to route against.
Source§

impl<Body> ProtocolInputExt for Request<Body>

Source§

fn protocol(&self) -> Option<&Protocol>

The application protocol, or None if it can’t be determined.
Source§

fn protocol_default_port(&self) -> Option<u16>

The default port of the resolved Protocol (e.g. 443 for HTTPS), or None if the protocol is unknown or portless.
Source§

impl<Body> TransportProtocolInputExt for Request<Body>

Source§

fn transport_protocol(&self) -> Option<TransportProtocol>

The transport protocol (TCP or UDP).
Source§

impl<Body> UriInputExt for Request<Body>

Source§

fn uri(&self) -> &Uri

The Uri this input carries.

Auto Trait Implementations§

§

impl<T> Freeze for Request<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Request<T>
where T: RefUnwindSafe,

§

impl<T> Send for Request<T>
where T: Send,

§

impl<T> Sync for Request<T>
where T: Sync,

§

impl<T> Unpin for Request<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Request<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Request<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> BodyExt for T
where T: Body + ?Sized,

Source§

fn frame(&mut self) -> Frame<'_, Self>
where Self: Unpin,

Returns a future that resolves to the next Frame, if any.
Source§

fn map_frame<F, B>(self, f: F) -> MapFrame<Self, F>
where Self: Sized, F: FnMut(Frame<Self::Data>) -> Frame<B>, B: Buf,

Maps this body’s frame to a different kind.
Source§

fn inspect_frame<F>(self, f: F) -> InspectFrame<Self, F>
where Self: Sized, F: FnMut(&Frame<Self::Data>),

A body that calls a function with a reference to each frame before yielding it.
Source§

fn map_err<F, E>(self, f: F) -> MapErr<Self, F>
where Self: Sized, F: FnMut(Self::Error) -> E,

Maps this body’s error value to a different value.
Source§

fn inspect_err<F>(self, f: F) -> InspectErr<Self, F>
where Self: Sized, F: FnMut(&Self::Error),

A body that calls a function with a reference to an error before yielding it.
Source§

fn boxed(self) -> BoxBody<Self::Data, Self::Error>
where Self: Sized + Send + Sync + 'static,

Turn this body into a boxed trait object.
Source§

fn boxed_unsync(self) -> UnsyncBoxBody<Self::Data, Self::Error>
where Self: Sized + Send + 'static,

Turn this body into a boxed trait object that is !Sync.
Source§

fn collect(self) -> Collect<Self>
where Self: Sized,

Turn this body into Collected body which will collect all the DATA frames and trailers. Read more
Source§

fn collect_with(self, opts: CollectOptions) -> CollectWith<Self>
where Self: Sized + Body<Data = Bytes, Error: Into<BoxError>> + Send + Sync + Unpin + 'static,

Collect this body, but bounded by the size cap and/or timeout in CollectOptions. Read more
Source§

fn with_trailers<F>(self, trailers: F) -> WithTrailers<Self, F>
where Self: Sized, F: Future<Output = Option<Result<HeaderMap, Self::Error>>>,

Add trailers to the body. Read more
Source§

fn into_data_stream(self) -> BodyDataStream<Self>
where Self: Sized,

Turn this body into BodyDataStream.
Source§

fn into_stream(self) -> BodyStream<Self>
where Self: Sized,

Turn this body into BodyStream.
Source§

fn fuse(self) -> Fuse<Self>
where Self: Sized,

Creates a fused body. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ConnectorTargetInputExt for T

Source§

fn connector_target(&self) -> Option<HostWithPort>

The host:port to connect to: the authority’s port if set, else the protocol’s default port. None when no host (or no port) resolves. Read more
Source§

fn connector_target_with_default_port( &self, default_port: u16, ) -> Option<HostWithPort>

Like connector_target but with default_port as the ultimate fallback (ConnectorTarget → authority port → protocol default → default_port), so it yields Some whenever an authority resolves at all. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> RamaFrom<T> for U
where U: From<T>,

Source§

fn rama_from(value: T) -> U

Source§

impl<T, U, CrateMarker> RamaInto<U, CrateMarker> for T
where U: RamaFrom<T, CrateMarker>,

Source§

fn rama_into(self) -> U

Source§

impl<T, U> RamaTryFrom<T> for U
where U: TryFrom<T>,

Source§

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

Source§

fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>

Source§

impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for T
where U: RamaTryFrom<T, CrateMarker>,

Source§

type Error = <U as RamaTryFrom<T, CrateMarker>>::Error

Source§

fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more