Trait ascii::IntoAsciiString
source · [−]pub trait IntoAsciiString: Sized {
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>>
Implementations on Foreign Types
sourceimpl 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>>
sourceimpl<'a> IntoAsciiString for &'a [AsciiChar]
impl<'a> IntoAsciiString for &'a [AsciiChar]
unsafe fn into_ascii_string_unchecked(self) -> AsciiString
fn into_ascii_string(self) -> Result<AsciiString, FromAsciiError<Self>>
sourceimpl 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>>
sourceimpl<'a> IntoAsciiString for &'a [u8]
impl<'a> IntoAsciiString for &'a [u8]
unsafe fn into_ascii_string_unchecked(self) -> AsciiString
fn into_ascii_string(self) -> Result<AsciiString, FromAsciiError<Self>>
sourceimpl IntoAsciiString for String
impl IntoAsciiString for String
unsafe fn into_ascii_string_unchecked(self) -> AsciiString
fn into_ascii_string(self) -> Result<AsciiString, FromAsciiError<Self>>
sourceimpl<'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>>
sourceimpl 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>>
sourceimpl<'a> IntoAsciiString for &'a CStr
impl<'a> IntoAsciiString for &'a CStr
Note that the trailing null byte will be removed in the conversion.