/// Create a new `SwfStr` with the given encoding from a Rust `str`.
/// The string will be re-encoded with the given encoding.
/// The string will be truncated if a null byte is encountered.
/// `None` is returned if the encoding is not lossless.
/// Intended for tests.
Create a new `SwfStr` with the given encoding from a Rust `str`.
The string will be re-encoded with the given encoding.
The string will be truncated if a null byte is encountered.
`None` is returned if the encoding is not lossless.
Intended for tests.
Create a new ` SwfStr ` with the given encoding from a Rust ` str ` . The string will be re - encoded with the given encoding . The string will be truncated if a null byte is encountered . ` None ` is returned if the encoding is not lossless . Intended for tests .
pub fn from_str_with_encoding<'a>(
        string: &'a str,
        encoding: &'static Encoding,
    ) -> Option<&'a Self> {
        if let (Cow::Borrowed(s), _, false) = encoding.encode(&string) {
            Some(Self::from_bytes(s))
        } else {
            None
        }
    }
pub fn from_str_with_encoding < ' a > ( string : & ' a str , encoding : & ' static Encoding , ) -> Option < & ' a Self > { if let ( Cow :: Borrowed ( s ) , _ , false ) = encoding . encode ( & string ) { Some ( Self :: from_bytes ( s ) ) } else { None } }
Create a new `SwfStr` with the given encoding from a Rust `str`.
Create a new ` SwfStr ` with the given encoding from a Rust ` str ` .
string
&'a str
encoding
&'static Encoding