Trait mediatype::WriteParams
source · pub trait WriteParams<'a>: ReadParams {
// Required methods
fn set_param<'n: 'a, 'v: 'a>(&mut self, name: Name<'n>, value: Value<'v>);
fn remove_params(&mut self, name: Name<'_>);
fn clear_params(&mut self);
}
Expand description
A trait for mutating parameter values.
Required Methods§
sourcefn set_param<'n: 'a, 'v: 'a>(&mut self, name: Name<'n>, value: Value<'v>)
fn set_param<'n: 'a, 'v: 'a>(&mut self, name: Name<'n>, value: Value<'v>)
Sets a parameter value.
If the parameters with the name already exist, they will be removed.
let madia_type = "text/plain; charset=UTF-8; charset=US-ASCII; format=fixed";
let mut text_plain = MediaType::parse(madia_type).unwrap();
text_plain.set_param(CHARSET, UTF_8);
assert_eq!(
text_plain.to_string(),
"text/plain; format=fixed; charset=UTF-8"
);
sourcefn remove_params(&mut self, name: Name<'_>)
fn remove_params(&mut self, name: Name<'_>)
Removes all parameters with the name.
sourcefn clear_params(&mut self)
fn clear_params(&mut self)
Removes all parameters.