Trait gmime::PartExt [−][src]
pub trait PartExt { fn get_best_content_encoding(
&self,
constraint: EncodingConstraint
) -> ContentEncoding; fn get_content(&self) -> Option<DataWrapper>; fn get_content_description(&self) -> Option<String>; fn get_content_encoding(&self) -> ContentEncoding; fn get_content_location(&self) -> Option<String>; fn get_content_md5(&self) -> Option<String>; fn get_filename(&self) -> Option<String>; fn get_openpgp_data(&self) -> OpenPGPData; fn is_attachment(&self) -> bool; fn openpgp_decrypt<'a, P: Into<Option<&'a str>>>(
&self,
flags: DecryptFlags,
session_key: P
) -> Result<Option<DecryptResult>, Error>; fn openpgp_sign(&self, userid: &str) -> Result<(), Error>; fn openpgp_verify(
&self,
flags: VerifyFlags
) -> Result<Option<SignatureList>, Error>; fn set_content(&self, content: &DataWrapper); fn set_content_description(&self, description: &str); fn set_content_encoding(&self, encoding: ContentEncoding); fn set_content_location(&self, content_location: &str); fn set_content_md5(&self, content_md5: &str); fn set_filename(&self, filename: &str); fn set_openpgp_data(&self, data: OpenPGPData); fn verify_content_md5(&self) -> bool; }
Trait containing all Part
methods.
Implementors
Required Methods
fn get_best_content_encoding(
&self,
constraint: EncodingConstraint
) -> ContentEncoding
&self,
constraint: EncodingConstraint
) -> ContentEncoding
Calculates the most efficient content encoding for the self
given the constraint
.
constraint
a EncodingConstraint
Returns
the best content encoding for the specified mime part.
fn get_content(&self) -> Option<DataWrapper>
Gets the internal data-wrapper of the specified mime part, or None
on error.
Returns
the data-wrapper for the mime part's contents.
fn get_content_description(&self) -> Option<String>
Gets the value of the Content-Description for the specified mime
part if it exists or None
otherwise.
Returns
the content description for the specified mime part.
fn get_content_encoding(&self) -> ContentEncoding
Gets the content encoding of the mime part.
Returns
the content encoding for the specified mime part.
fn get_content_location(&self) -> Option<String>
Gets the value of the Content-Location header if it exists, or
None
otherwise.
Returns
the content location for the specified mime part.
fn get_content_md5(&self) -> Option<String>
Gets the md5sum contained in the Content-Md5 header of the
specified mime part if it exists, or None
otherwise.
Returns
the content md5 for the specified mime part.
fn get_filename(&self) -> Option<String>
Gets the filename of the specificed mime part, or None
if the
self
does not have the filename or name parameter set.
Returns
the filename of the specified self
or None
if
neither of the parameters is set. If a file name is set, the
returned string will be in UTF-8.
fn get_openpgp_data(&self) -> OpenPGPData
Gets whether or not (and what type) of OpenPGP data is contained
within the Part
.
Returns
a OpenPGPData
.
fn is_attachment(&self) -> bool
Determines whether or not the part is an attachment based on the value of the Content-Disposition header.
Returns
true
if the part is an attachment, otherwise false
.
fn openpgp_decrypt<'a, P: Into<Option<&'a str>>>(
&self,
flags: DecryptFlags,
session_key: P
) -> Result<Option<DecryptResult>, Error>
&self,
flags: DecryptFlags,
session_key: P
) -> Result<Option<DecryptResult>, Error>
Decrypts the content of the self
and then replaces the content with
the new, decrypted, content.
flags
a set of DecryptFlags
session_key
the session key to use or None
Returns
a DecryptResult
on success or None
on error.
fn openpgp_sign(&self, userid: &str) -> Result<(), Error>
Signs the content of the self
and then replaces the content with
the new, signed, content.
userid
the key id (or email address) to use for signing
Returns
true
on success or false
on error.
fn openpgp_verify(
&self,
flags: VerifyFlags
) -> Result<Option<SignatureList>, Error>
&self,
flags: VerifyFlags
) -> Result<Option<SignatureList>, Error>
Verifies the OpenPGP signature of the self
and then replaces the content
with the original, raw, content.
flags
a set of VerifyFlags
Returns
a SignatureList
on success or None
on error.
fn set_content(&self, content: &DataWrapper)
fn set_content_description(&self, description: &str)
fn set_content_encoding(&self, encoding: ContentEncoding)
fn set_content_location(&self, content_location: &str)
fn set_content_md5(&self, content_md5: &str)
Set the content md5 for the specified mime part.
content_md5
content md5 or None
to generate the md5 digest.
fn set_filename(&self, filename: &str)
Sets the "filename" parameter on the Content-Disposition and also sets the "name" parameter on the Content-Type.
Note: The filename
string should be in UTF-8.
filename
the file name
fn set_openpgp_data(&self, data: OpenPGPData)
Sets whether or not (and what type) of OpenPGP data is contained
within the Part
.
data
a OpenPGPData
fn verify_content_md5(&self) -> bool
Verify the content md5 for the specified mime part.
Returns
true
if the md5 is valid or false
otherwise. Note: will
return false
if the mime part does not contain a Content-MD5.
Implementors
impl<O: IsA<Part>> PartExt for O