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§

source

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"
);
source

fn remove_params(&mut self, name: Name<'_>)

Removes all parameters with the name.

source

fn clear_params(&mut self)

Removes all parameters.

Implementors§

source§

impl<'a> WriteParams<'a> for MediaType<'a>