Function from_utf8
Source pub fn from_utf8(input: &[u8]) -> Result<&str, Utf8Error>
Expand description
Analogue to [std::str::from_utf8()
].
Checks if the passed byte sequence is valid UTF-8 and returns an
[std::str
] reference to the passed byte slice wrapped in Ok()
if it is.
ยงErrors
Will return the zero-sized Err(Utf8Error
) on if the input contains invalid UTF-8.