#text #line #truncate #length #numbers #parameters

trunc8

Truncate text to a specific line length, based on a number of parameters

2 unstable releases

0.2.0 Nov 22, 2023
0.1.0 Nov 19, 2023

#9 in #truncate

Download history 1/week @ 2024-02-14 4/week @ 2024-02-21 8/week @ 2024-02-28 9/week @ 2024-03-27 20/week @ 2024-04-03 39/week @ 2024-04-10 7/week @ 2024-04-17

75 downloads per month

BSD-3-Clause

13KB
93 lines

trunc8

This is a tiny library for Rust, used to truncate text lines to a specific length. This library is still a work in progress, so please check back for updates.

Installation

Inside your rust project:

cargo add trunc8

Usage

fn main() {
    let lines = trunc8::truncate("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ultricies mi eget mauris pharetra et ultrices. Hendrerit dolor magna eget est lorem. Ullamcorper eget nulla facilisi etiam dignissim diam quis enim. Cursus vitae congue mauris rhoncus aenean vel elit scelerisque. Diam vulputate ut pharetra sit amet aliquam id diam maecenas. Molestie ac feugiat sed lectus. Ac turpis egestas integer eget. Blandit libero volutpat sed cras ornare arcu dui vivamus. Volutpat diam ut venenatis tellus. Id porta nibh venenatis cras sed felis eget velit.", 80);

    lines.iter().for_each(|line| {
        ...
    });
}

Development

After checking out the repo, make any additions or fixes in the src folder. Make sure to add appropriate tests in lib.rs, and ensure your changes work before submitting a pull request, by running cargo test.

Contributing

Bug reports and pull requests are welcome on GitHub @ https://github.com/pinecat/trunc8.

License

This library is available as open source under the term of the BSD 3 Clause License.

No runtime deps