[−][src]Crate range_split
Utilities for splitting sequences with range parameters.
The TakeRange
trait provides polymorphic, easily memorizable methods
for splitting indexed sequences with a parameter given in range syntax.
use range_split::TakeRange; let mut buf = Bytes::from("Hello, world"); let p = buf.take_range(..5); buf.remove_range(2..); assert_eq!(p, "Hello"); assert_eq!(buf, ", ");
is equivalent to
let mut buf = Bytes::from("Hello, world"); let p = buf.split_to(5); buf.truncate(2);
Implementations of TakeRange
are provided for Bytes
and BytesMut
from the crate bytes
if the bytes
compile-time feature is enabled.
Modules
mem | Utilities for working with ranges of collections in memory. |
str | Utilities for validating ranges on UTF-8 strings. |
Macros
assert_str_range | Asserts that the given range is valid for the given string slice. |
Traits
TakeRange | Methods for splitting out part of a collection with a given range. |