RopeSlice::as_str() can fail if the slice isn't contiguous in memory, so calling .unwrap() would crash the program. However, it isn't necessary to call as_str() in the first place, because Span::raw takes any type that can be converted to Cow<'a, str>, and RopeSlice is one of those types.
write_token's signature is also changed to compensate.
RopeSlice::as_str()
can fail if the slice isn't contiguous in memory, so calling.unwrap()
would crash the program. However, it isn't necessary to callas_str()
in the first place, becauseSpan::raw
takes any type that can be converted toCow<'a, str>
, andRopeSlice
is one of those types.write_token
's signature is also changed to compensate.