str
Expand description
string slice
Implementations
fn try_as_str_array(self) -> Option<S>
fn try_as_str_array(self) -> Option<S>
Attempts to convert the string slice into a string array.
Returns
- [Option] -
Some(str_array)
if the lengths of theS
str_array type and the string slice’s lengths match. ElseNone
.
Examples
fn foo() {
let string_slice = "abcd";
let string_array: str[4] = a.try_as_str_array().unwrap();
}