pub trait AsAsciiStr {
// Required methods
unsafe fn as_ascii_str_unchecked(&self) -> &AsciiStr;
fn as_ascii_str(&self) -> Result<&AsciiStr, AsAsciiStrError>;
}
Expand description
Convert slices of bytes to AsciiStr
.
Required Methods§
Sourceunsafe fn as_ascii_str_unchecked(&self) -> &AsciiStr
unsafe fn as_ascii_str_unchecked(&self) -> &AsciiStr
Convert to an ASCII slice without checking for non-ASCII characters.
Sourcefn as_ascii_str(&self) -> Result<&AsciiStr, AsAsciiStrError>
fn as_ascii_str(&self) -> Result<&AsciiStr, AsAsciiStrError>
Convert to an ASCII slice.
Implementations on Foreign Types§
Source§impl AsAsciiStr for str
impl AsAsciiStr for str
fn as_ascii_str(&self) -> Result<&AsciiStr, AsAsciiStrError>
unsafe fn as_ascii_str_unchecked(&self) -> &AsciiStr
Source§impl AsAsciiStr for CStr
Note that the trailing null byte will be removed in the conversion.
impl AsAsciiStr for CStr
Note that the trailing null byte will be removed in the conversion.