Trait ascii::AsAsciiStr
source · 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
impl AsAsciiStr for CStr
Note that the trailing null byte will be removed in the conversion.