pub enum WordEncoder {
BEncoding,
QEncoding,
}Expand description
An RFC 2047 encoded-word encoder.
Variants§
BEncoding
Base64 encoding scheme as defined by RFC 2045.
QEncoding
Q-encoding scheme as defined by RFC 2047.
Implementations§
Source§impl WordEncoder
impl WordEncoder
Sourcepub fn encode(&self, charset: &str, s: &str) -> String
pub fn encode(&self, charset: &str, s: &str) -> String
Returns the encoded-word form of s.
If s is ASCII without special characters, it is returned unchanged. The provided charset is the IANA charset name of s (case insensitive).
§Examples
use yamime::WordEncoder;
let encoder = WordEncoder::QEncoding;
let encoded = encoder.encode("UTF-8", "Hello, 世界");
assert!(encoded.starts_with("=?UTF-8?q?"));Trait Implementations§
Source§impl Clone for WordEncoder
impl Clone for WordEncoder
Source§fn clone(&self) -> WordEncoder
fn clone(&self) -> WordEncoder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WordEncoder
impl Debug for WordEncoder
Source§impl PartialEq for WordEncoder
impl PartialEq for WordEncoder
impl Copy for WordEncoder
impl Eq for WordEncoder
impl StructuralPartialEq for WordEncoder
Auto Trait Implementations§
impl Freeze for WordEncoder
impl RefUnwindSafe for WordEncoder
impl Send for WordEncoder
impl Sync for WordEncoder
impl Unpin for WordEncoder
impl UnwindSafe for WordEncoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more