db4d60afb0
`slice_shift_char` splits a `str` into it's leading `char` and the remainder of the `str`. Currently, it returns a `(Option<char>, &str)` such that: "bar".slice_shift_char() => (Some('b'), "ar") "ar".slice_shift_char() => (Some('a'), "r") "r".slice_shift_char() => (Some('r'), "") "".slice_shift_char() => (None, "") This is a little odd. Either a `str` can be split into both a head and a tail or it cannot. So the return type should be `Option<(char, &str)>`. With the current behaviour, in the case of the empty string, the `str` returned is meaningless - it is always the empty string. This PR changes `slice_shift_char` so that: "bar".slice_shift_char() => Some(('b', "ar")) "ar".slice_shift_char() => Some(('a', "r")) "r".slice_shift_char() => Some(('r', "")) "".slice_shift_char() => None |
||
---|---|---|
.. | ||
f32.rs | ||
f64.rs | ||
float_macros.rs | ||
i8.rs | ||
i16.rs | ||
i32.rs | ||
i64.rs | ||
int_macros.rs | ||
int.rs | ||
mod.rs | ||
u8.rs | ||
u16.rs | ||
u32.rs | ||
u64.rs | ||
uint_macros.rs | ||
uint.rs |