#string #slice #parsing #parser #slicing

slicer

A utility that slices string slices into smaller string slices

2 releases

Uses old Rust 2015

0.1.1 May 3, 2018
0.1.0 May 3, 2018

#64 in #slice

Download history 90/week @ 2022-06-12 85/week @ 2022-06-19 84/week @ 2022-06-26 85/week @ 2022-07-03 64/week @ 2022-07-10 73/week @ 2022-07-17 69/week @ 2022-07-24 128/week @ 2022-07-31 46/week @ 2022-08-07 63/week @ 2022-08-14 66/week @ 2022-08-21 71/week @ 2022-08-28 115/week @ 2022-09-04 130/week @ 2022-09-11 78/week @ 2022-09-18 90/week @ 2022-09-25

415 downloads per month

MIT/Apache

37KB
408 lines

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.


lib.rs:

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

No runtime deps