pub trait IntoAsciiString: Sized {
// Required methods
unsafe fn into_ascii_string_unchecked(self) -> AsciiString;
fn into_ascii_string(self) -> Result<AsciiString, FromAsciiError<Self>>;
}
Expand description
Convert vectors into AsciiString
.
Required Methods§
Sourceunsafe fn into_ascii_string_unchecked(self) -> AsciiString
unsafe fn into_ascii_string_unchecked(self) -> AsciiString
Convert to AsciiString
without checking for non-ASCII characters.
§Safety
If self
contains non-ascii characters, calling this function is
undefined behavior.
Sourcefn into_ascii_string(self) -> Result<AsciiString, FromAsciiError<Self>>
fn into_ascii_string(self) -> Result<AsciiString, FromAsciiError<Self>>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl IntoAsciiString for CString
impl IntoAsciiString for CString
§Notes
The trailing null byte CString
has will be removed during this conversion.
unsafe fn into_ascii_string_unchecked(self) -> AsciiString
fn into_ascii_string(self) -> Result<AsciiString, FromAsciiError<Self>>
Source§impl IntoAsciiString for String
impl IntoAsciiString for String
unsafe fn into_ascii_string_unchecked(self) -> AsciiString
fn into_ascii_string(self) -> Result<AsciiString, FromAsciiError<Self>>
Source§impl IntoAsciiString for Vec<AsciiChar>
impl IntoAsciiString for Vec<AsciiChar>
unsafe fn into_ascii_string_unchecked(self) -> AsciiString
fn into_ascii_string(self) -> Result<AsciiString, FromAsciiError<Self>>
Source§impl IntoAsciiString for Vec<u8>
impl IntoAsciiString for Vec<u8>
unsafe fn into_ascii_string_unchecked(self) -> AsciiString
fn into_ascii_string(self) -> Result<AsciiString, FromAsciiError<Self>>
Source§impl<'a> IntoAsciiString for &'a str
impl<'a> IntoAsciiString for &'a str
unsafe fn into_ascii_string_unchecked(self) -> AsciiString
fn into_ascii_string(self) -> Result<AsciiString, FromAsciiError<Self>>
Source§impl<'a> IntoAsciiString for &'a CStr
impl<'a> IntoAsciiString for &'a CStr
Note that the trailing null byte will be removed in the conversion.