Trait gmime::HeaderListExt [−][src]
pub trait HeaderListExt { fn append(&self, name: &str, value: &str, charset: &str); fn clear(&self); fn contains(&self, name: &str) -> bool; fn get_count(&self) -> i32; fn get_header(&self, name: &str) -> Option<Header>; fn get_header_at(&self, index: i32) -> Option<Header>; fn prepend(&self, name: &str, value: &str, charset: &str); fn remove(&self, name: &str) -> bool; fn remove_at(&self, index: i32); fn set(&self, name: &str, value: &str, charset: &str); fn to_string<'a, P: Into<Option<&'a FormatOptions>>>(
&self,
options: P
) -> String; fn write_to_stream<'a, P: Into<Option<&'a FormatOptions>>, Q: IsA<Stream>>(
&self,
options: P,
stream: &Q
) -> isize; }
Required Methods
fn append(&self, name: &str, value: &str, charset: &str)
Appends a header. If value
is None
, a space will be set aside for it
(useful for setting the order of headers before values can be
obtained for them) otherwise the header will be unset.
name
header name
value
header value
charset
a charset
fn clear(&self)
Removes all of the headers from the HeaderList
.
fn contains(&self, name: &str) -> bool
Checks whether or not a header exists.
name
header name
Returns
true
if the specified header exists or false
otherwise.
fn get_count(&self) -> i32
Gets the number of headers contained within the header list.
Returns
the number of headers in the header list.
fn get_header(&self, name: &str) -> Option<Header>
Gets the first header with the specified name.
name
header name
Returns
a Header
for the specified name
.
fn get_header_at(&self, index: i32) -> Option<Header>
Gets the header at the specified index
within the list.
index
the 0-based index of the header
Returns
the header at position index
.
fn prepend(&self, name: &str, value: &str, charset: &str)
Prepends a header. If value
is None
, a space will be set aside
for it (useful for setting the order of headers before values can
be obtained for them) otherwise the header will be unset.
name
header name
value
header value
charset
a charset
fn remove(&self, name: &str) -> bool
Remove the first instance of the specified header.
name
header name
Returns
true
if the header was successfully removed or false
if
the specified header could not be found.
fn remove_at(&self, index: i32)
Removes the header at the specified index
from self
.
index
the 0-based index of the header to remove
fn set(&self, name: &str, value: &str, charset: &str)
Set the value of the specified header. If value
is None
and the
header, name
, had not been previously set, a space will be set
aside for it (useful for setting the order of headers before values
can be obtained for them) otherwise the header will be unset.
Note: If there are multiple headers with the specified field name, the first instance of the header will be replaced and further instances will be removed.
name
header name
value
header value
charset
a charset
fn to_string<'a, P: Into<Option<&'a FormatOptions>>>(
&self,
options: P
) -> String
&self,
options: P
) -> String
Allocates a string buffer containing the raw rfc822 headers
contained in self
.
options
a FormatOptions
or None
Returns
a string containing the header block.
fn write_to_stream<'a, P: Into<Option<&'a FormatOptions>>, Q: IsA<Stream>>(
&self,
options: P,
stream: &Q
) -> isize
&self,
options: P,
stream: &Q
) -> isize
Implementors
impl<O: IsA<HeaderList>> HeaderListExt for O