Closed Rimpampa closed 2 years ago
Accessing a str through a rage index may cause panic if the string contains multibyte chars. Another solution would be to do data.as_bytes()[0..4] != b"HC1:", because by considering them as raw bytes no panic can occur.
str
char
data.as_bytes()[0..4] != b"HC1:"
Accessing a
str
through a rage index may cause panic if the string contains multibytechar
s. Another solution would be to dodata.as_bytes()[0..4] != b"HC1:"
, because by considering them as raw bytes no panic can occur.