SessionRequest

Struct SessionRequest 

Source
pub struct SessionRequest(/* private fields */);
Expand description

A CONNECT WebTransport request.

Implementations§

Source§

impl SessionRequest

Source

pub const RESERVED_HEADERS: &'static [&'static str]

A collection of reserved headers used in the WebTransport protocol.

Reserved headers have special significance in the WebTransport protocol and cannot be used as additional headers with the insert method.

The following headers are considered reserved:

  • :method
  • :scheme
  • :protocol
  • :authority
  • :path
Source

pub fn new<S>(url: S) -> Result<Self, UrlParseError>
where S: AsRef<str>,

Parses an URL to build a Session request.

Source

pub fn authority(&self) -> &str

Returns the :authority field of the request.

Source

pub fn path(&self) -> &str

Returns the :path field of the request.

Source

pub fn origin(&self) -> Option<&str>

Returns the origin field of the request if present.

Source

pub fn user_agent(&self) -> Option<&str>

Returns the user-agent field of the request if present.

Source

pub fn get<K>(&self, key: K) -> Option<&str>
where K: AsRef<str>,

Gets a field from the request (if present).

Source

pub fn insert<K, V>(&mut self, key: K, value: V) -> Result<(), ReservedHeader>
where K: ToString, V: ToString,

Inserts a key-value pair into the header map, checking for reserved headers.

This method inserts a key-value pair into the header map after ensuring that the specified key is not one of the reserved headers. If the key is reserved, the method returns an Err(ReservedHeader) indicating the attempt to insert a value for a reserved header.

If the key already exists in the header map, the corresponding value is updated with the new value.

Source

pub fn headers(&self) -> &Headers

Returns the whole headers associated with the request.

Trait Implementations§

Source§

impl Debug for SessionRequest

Source§

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

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

impl TryFrom<Headers> for SessionRequest

Source§

type Error = HeadersParseError

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

fn try_from(headers: Headers) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

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<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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.