pub struct Builder { /* private fields */ }
Expand description
A constructed via warp::cors()
.
Implementations
sourceimpl Builder
impl Builder
sourcepub fn allow_credentials(self, allow: bool) -> Builder
pub fn allow_credentials(self, allow: bool) -> Builder
Sets whether to add the Access-Control-Allow-Credentials
header.
sourcepub fn allow_method<M>(self, method: M) -> Builder where
Method: TryFrom<M>,
pub fn allow_method<M>(self, method: M) -> Builder where
Method: TryFrom<M>,
Adds a method to the existing list of allowed request methods.
Panics
Panics if the provided argument is not a valid http::Method
.
sourcepub fn allow_methods<I>(self, methods: I) -> Builder where
I: IntoIterator,
Method: TryFrom<<I as IntoIterator>::Item>,
pub fn allow_methods<I>(self, methods: I) -> Builder where
I: IntoIterator,
Method: TryFrom<<I as IntoIterator>::Item>,
Adds multiple methods to the existing list of allowed request methods.
Panics
Panics if the provided argument is not a valid http::Method
.
sourcepub fn allow_header<H>(self, header: H) -> Builder where
HeaderName: TryFrom<H>,
pub fn allow_header<H>(self, header: H) -> Builder where
HeaderName: TryFrom<H>,
Adds a header to the list of allowed request headers.
Note: These should match the values the browser sends via Access-Control-Request-Headers
, e.g. content-type
.
Panics
Panics if the provided argument is not a valid http::header::HeaderName
.
sourcepub fn allow_headers<I>(self, headers: I) -> Builder where
I: IntoIterator,
HeaderName: TryFrom<<I as IntoIterator>::Item>,
pub fn allow_headers<I>(self, headers: I) -> Builder where
I: IntoIterator,
HeaderName: TryFrom<<I as IntoIterator>::Item>,
Adds multiple headers to the list of allowed request headers.
Note: These should match the values the browser sends via Access-Control-Request-Headers
, e.g.content-type
.
Panics
Panics if any of the headers are not a valid http::header::HeaderName
.
sourcepub fn expose_header<H>(self, header: H) -> Builder where
HeaderName: TryFrom<H>,
pub fn expose_header<H>(self, header: H) -> Builder where
HeaderName: TryFrom<H>,
Adds a header to the list of exposed headers.
Panics
Panics if the provided argument is not a valid http::header::HeaderName
.
sourcepub fn expose_headers<I>(self, headers: I) -> Builder where
I: IntoIterator,
HeaderName: TryFrom<<I as IntoIterator>::Item>,
pub fn expose_headers<I>(self, headers: I) -> Builder where
I: IntoIterator,
HeaderName: TryFrom<<I as IntoIterator>::Item>,
Adds multiple headers to the list of exposed headers.
Panics
Panics if any of the headers are not a valid http::header::HeaderName
.
sourcepub fn allow_any_origin(self) -> Builder
pub fn allow_any_origin(self) -> Builder
Sets that any Origin
header is allowed.
Warning
This can allow websites you didn’t intend to access this resource, it is usually better to set an explicit list.
sourcepub fn allow_origin(self, origin: impl IntoOrigin) -> Builder
pub fn allow_origin(self, origin: impl IntoOrigin) -> Builder
Add an origin to the existing list of allowed Origin
s.
Panics
Panics if the provided argument is not a valid Origin
.
sourcepub fn allow_origins<I>(self, origins: I) -> Builder where
I: IntoIterator,
<I as IntoIterator>::Item: IntoOrigin,
pub fn allow_origins<I>(self, origins: I) -> Builder where
I: IntoIterator,
<I as IntoIterator>::Item: IntoOrigin,
Add multiple origins to the existing list of allowed Origin
s.
Panics
Panics if the provided argument is not a valid Origin
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more