Struct ContentDisposition
pub struct ContentDisposition(/* private fields */);http and std only.Expand description
A Content-Disposition header, (re)defined in RFC6266.
The Content-Disposition response header field is used to convey additional information about how to process the response payload, and also can be used to attach additional metadata, such as the filename to use when saving the response payload locally.
§ABNF
content-disposition = "Content-Disposition" ":"
disposition-type *( ";" disposition-parm )
disposition-type = "inline" | "attachment" | disp-ext-type
; case-insensitive
disp-ext-type = token
disposition-parm = filename-parm | disp-ext-parm
filename-parm = "filename" "=" value
| "filename*" "=" ext-value
disp-ext-parm = token "=" value
| ext-token "=" ext-value
ext-token = <the characters in token, followed by "*">§Example
use rama_http_headers::ContentDisposition;
let cd = ContentDisposition::inline();Implementations§
§impl ContentDisposition
impl ContentDisposition
pub fn inline() -> ContentDisposition
pub fn inline() -> ContentDisposition
Construct a Content-Disposition: inline header.
pub fn attachment(filename: &str) -> ContentDisposition
pub fn attachment(filename: &str) -> ContentDisposition
Construct a Content-Disposition: attachment header with a filename.
The filename is encoded as a quoted string. Non-ASCII filenames also get
an RFC 8187 filename* parameter. If the filename contains control
characters this falls back to a plain attachment header.
pub fn try_attachment(
filename: &str,
) -> Result<ContentDisposition, InvalidContentDispositionFilename>
pub fn try_attachment( filename: &str, ) -> Result<ContentDisposition, InvalidContentDispositionFilename>
Construct an attachment header, rejecting filenames with control characters.
pub fn is_attachment(&self) -> bool
pub fn is_attachment(&self) -> bool
Check if the disposition-type is attachment.
pub fn is_form_data(&self) -> bool
pub fn is_form_data(&self) -> bool
Check if the disposition-type is form-data.
Trait Implementations§
§impl Clone for ContentDisposition
impl Clone for ContentDisposition
§fn clone(&self) -> ContentDisposition
fn clone(&self) -> ContentDisposition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ContentDisposition
impl Debug for ContentDisposition
§impl HeaderDecode for ContentDisposition
impl HeaderDecode for ContentDisposition
§fn decode<'i, I>(values: &mut I) -> Result<ContentDisposition, Error>where
I: Iterator<Item = &'i HeaderValue>,
fn decode<'i, I>(values: &mut I) -> Result<ContentDisposition, Error>where
I: Iterator<Item = &'i HeaderValue>,
HeaderValues.§impl HeaderEncode for ContentDisposition
impl HeaderEncode for ContentDisposition
§fn encode<E>(&self, values: &mut E)where
E: Extend<HeaderValue>,
fn encode<E>(&self, values: &mut E)where
E: Extend<HeaderValue>,
HeaderValue, and add it to a container
which has HeaderValue type as each element. Read more§fn encode_to_value(&self) -> Option<HeaderValue>
fn encode_to_value(&self) -> Option<HeaderValue>
HeaderValue. Read more§impl TypedHeader for ContentDisposition
impl TypedHeader for ContentDisposition
§fn name() -> &'static HeaderName
fn name() -> &'static HeaderName
Auto Trait Implementations§
impl !Freeze for ContentDisposition
impl RefUnwindSafe for ContentDisposition
impl Send for ContentDisposition
impl Sync for ContentDisposition
impl Unpin for ContentDisposition
impl UnsafeUnpin for ContentDisposition
impl UnwindSafe for ContentDisposition
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more