Crate slicer [] [src]

A simple, efficient utility for slicing string slices into smaller string slices. Useful for parsing anything represented by strings, such as programming languages or data formats.

Examples

Basic usage:

let path = "images/cat.jpeg";
let mut slicer = path.as_slicer();
 
let directory = slicer.slice_until("/");
slicer.skip_over("/");
let filename = slicer.slice_until(".");
slicer.skip_over(".");
let extension = slicer.slice_to_end();
 
assert_eq!(Some("images"), directory);
assert_eq!(Some("cat"), filename);
assert_eq!(Some("jpeg"), extension);

Modules

trackers

A module containing various Tracker types.

Structs

StrSlicer

A string slicer.

Traits

AsSlicer

Describes a type that can be cheaply converted into a StrSlicer.

Pattern

Describes a type that can be used as an input to many of StrSlicer's methods.

Tracker

Describes a type that tracks information as the StrSlicer goes through the string.