pub struct ContentDisposition(/* private fields */);Expand description
MIME content-disposition token (RFC 2183).
§Equality and hashing
Same shape as ContentType: construction lowercases the disposition
kind and parameter names, then PartialEq / Eq / Hash compare that
normalized string. RFC 2183 §3 makes the disposition type and parameter
names case-insensitive but leaves parameter value case sensitivity
dependent on the parameter. The kernel preserves parameter values
verbatim; for semantic comparison route through the disposition’s
accessors rather than comparing raw input strings.
Implementations§
Source§impl ContentDisposition
impl ContentDisposition
pub fn as_str(&self) -> &str
Sourcepub fn kind(&self) -> &str
pub fn kind(&self) -> &str
Borrowed disposition kind ("inline", "attachment", or an
x- extension), with no parameters.
Cheap: it slices the stored string; no allocation. Validation guarantees a well-formed disposition token prefix exists.
Sourcepub fn parameters(&self) -> impl Iterator<Item = (&str, ParameterValue<'_>)>
pub fn parameters(&self) -> impl Iterator<Item = (&str, ParameterValue<'_>)>
Iterate (name, value) parameter pairs in declaration order.
Quoted values are returned with surrounding quotes stripped and
backslash escapes resolved, mirroring ContentType::parameters.
Sourcepub fn parameter(&self, name: &str) -> Option<ParameterValue<'_>>
pub fn parameter(&self, name: &str) -> Option<ParameterValue<'_>>
Look up a parameter by case-insensitive name.
Sourcepub fn filename(&self) -> Option<ParameterValue<'_>>
pub fn filename(&self) -> Option<ParameterValue<'_>>
Convenience accessor for the filename parameter.
RFC 2183 §2.3 defines this as the suggested filename a recipient’s
mail client should use when saving the attachment to disk. For
non-ASCII filenames the kernel emits filename* (RFC 2231
charset/language extension); this accessor returns filename when
present and otherwise falls back to filename*.
Sourcepub fn is_inline(&self) -> bool
pub fn is_inline(&self) -> bool
Returns true if the disposition kind is inline
(case-insensitive).
Sourcepub fn is_attachment(&self) -> bool
pub fn is_attachment(&self) -> bool
Returns true if the disposition kind is attachment
(case-insensitive).
Trait Implementations§
Source§impl<'a> Arbitrary<'a> for ContentDisposition
Available on crate feature arbitrary only.
impl<'a> Arbitrary<'a> for ContentDisposition
arbitrary only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl Clone for ContentDisposition
impl Clone for ContentDisposition
Source§fn clone(&self) -> ContentDisposition
fn clone(&self) -> ContentDisposition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ContentDisposition
impl Debug for ContentDisposition
Source§impl<'de> Deserialize<'de> for ContentDisposition
Available on crate feature serde only.
impl<'de> Deserialize<'de> for ContentDisposition
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Display for ContentDisposition
impl Display for ContentDisposition
Source§impl FromStr for ContentDisposition
impl FromStr for ContentDisposition
Source§impl Hash for ContentDisposition
impl Hash for ContentDisposition
Source§impl JsonSchema for ContentDisposition
Available on crate feature schemars only.
impl JsonSchema for ContentDisposition
schemars only.Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(_generator: &mut SchemaGenerator) -> Schema
fn json_schema(_generator: &mut SchemaGenerator) -> Schema
Source§impl PartialEq for ContentDisposition
impl PartialEq for ContentDisposition
Source§impl Serialize for ContentDisposition
Available on crate feature serde only.
impl Serialize for ContentDisposition
serde only.