Struct worker::Fetcher

source ·
pub struct Fetcher(_);
Expand description

A struct for invoking fetch events to other Workers.

Implementations§

source§

impl Fetcher

source

pub async fn fetch( &self, url: impl Into<String>, init: Option<RequestInit> ) -> Result<Response>

Invoke a fetch event in a worker with a url and optionally a RequestInit.

source

pub async fn fetch_request(&self, request: Request) -> Result<Response>

Invoke a fetch event with an existing Request.

Trait Implementations§

source§

impl AsRef<JsValue> for Fetcher

source§

fn as_ref(&self) -> &JsValue

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl EnvBinding for Fetcher

source§

const TYPE_NAME: &'static str = "Fetcher"

source§

fn get(val: JsValue) -> Result<Self>

source§

impl From<Fetcher> for Fetcher

source§

fn from(inner: Fetcher) -> Self

Converts to this type from the input type.
source§

impl From<Fetcher> for JsValue

source§

fn from(service: Fetcher) -> Self

Converts to this type from the input type.
source§

impl JsCast for Fetcher

source§

fn instanceof(val: &JsValue) -> bool

Performs a dynamic instanceof check to see whether the JsValue provided is an instance of this type. Read more
source§

fn unchecked_from_js(val: JsValue) -> Self

Performs a zero-cost unchecked conversion from a JsValue into an instance of Self Read more
source§

fn unchecked_from_js_ref(val: &JsValue) -> &Self

Performs a zero-cost unchecked conversion from a &JsValue into an instance of &Self. Read more
source§

fn has_type<T>(&self) -> boolwhere T: JsCast,

Test whether this JS value has a type T. Read more
source§

fn dyn_into<T>(self) -> Result<T, Self>where T: JsCast,

Performs a dynamic cast (checked at runtime) of this value into the target type T. Read more
source§

fn dyn_ref<T>(&self) -> Option<&T>where T: JsCast,

Performs a dynamic cast (checked at runtime) of this value into the target type T. Read more
source§

fn unchecked_into<T>(self) -> Twhere T: JsCast,

Performs a zero-cost unchecked cast into the specified type. Read more
source§

fn unchecked_ref<T>(&self) -> &Twhere T: JsCast,

Performs a zero-cost unchecked cast into a reference to the specified type. Read more
source§

fn is_instance_of<T>(&self) -> boolwhere T: JsCast,

Test whether this JS value is an instance of the type T. Read more
source§

fn is_type_of(val: &JsValue) -> bool

Performs a dynamic check to see whether the JsValue provided is a value of this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.