slicer 0.1.1

A utility that slices string slices into smaller string slices.
Documentation
  • Coverage
  • 97.83%
    45 out of 46 items documented30 out of 44 items with examples
  • Size
  • Source code size: 48.31 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.82 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • squishy-clouds/slicer
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • squishy-clouds

slicer

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:

use slicer::AsSlicer;

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);

License

This crate is licensed under the terms of both the MIT License and the Apache License 2.0.