read_lines_into/
lib.rs

1//! # read_lines_into Rust crate
2//! 
3//! Read lines (from Path, File, BufRead) into a struct (String, Vec<String>).
4//! 
5//! Examples:
6//! 
7//! ```rust
8//! use std::path::Path;
9//! use read_lines_into::traits::*;
10//! 
11//! // Choose any existing text file
12//! let path = Path::new("example.txt");
13//! 
14//! // Read lines from the path's file into a string
15//! let string = path.read_lines_into_string().unwrap();
16//! 
17//! // Read lines from the path's file into a vector of strings
18//! let strings = path.read_lines_into_vec_string().unwrap();
19//! ```
20//! 
21//! ## Install
22//! 
23//! Add dependency:
24//! 
25//! ```toml
26//! [dependencies]
27//! read_lines_into = "*"
28//! ```
29//! 
30//! ## Notes
31//! 
32//! These functions are written to be easy to understand,
33//! so you can copy them into your own code if you wish.
34//! 
35//! These functions use buffered readers for efficiency.
36//! 
37//! If you're reading very large files, then you may prefer
38//! to write your own code to process each line as it's read.
39//! 
40//! ## Line endings using LF and CRLF
41//! 
42//! Unix systems typically end text lines with `\n` LINE FEED (LF).
43//! 
44//! Windows systems typically end text lines with `\r` CARRIAGE RETURN (CR)
45//! then `\n` LINE FEED (LF).
46//! 
47//! ## Tests
48//! 
49//! Test files have 3 content variations:
50//!
51//!   * example.txt has lines that end with LF.
52//!   * example-with-crlf.txt has lines that end wit CRLF.
53//!   * example-with-indent.txt has lines with leading spaces.
54//!
55//! ## Tracking
56//! 
57//! * Project: read-lines-into-rust-crate
58//! * Version: 1.0.0
59//! * Created: 2022-10-01T22:58:34Z
60//! * Updated: 2022-10-14T01:07:18Z
61//! * Website: https://github.com/sixarm/read-lines-into-rust-crate
62//! * Contact: Joel Parker Henderson <joel@joelparkerhenderson.com>
63//! * License: MIT OR Apache-2.0 OR GPL-2.0 OR GPL-3.0
64
65// use std::fs::File;
66// use std::io::BufRead;
67// use std::io::BufReader;
68// use std::path::Path;
69
70pub mod traits;
71pub mod buf_reader {
72    pub mod read_lines_into_string;
73    pub mod read_lines_into_string_with_clip;
74    pub mod read_lines_into_string_with_trim;
75    pub mod read_lines_into_vec_string;
76    pub mod read_lines_into_vec_string_with_clip;
77    pub mod read_lines_into_vec_string_with_trim;
78}
79pub mod file {
80    pub mod read_lines_into_string;
81    pub mod read_lines_into_string_with_clip;
82    pub mod read_lines_into_string_with_trim;
83    pub mod read_lines_into_vec_string;
84    pub mod read_lines_into_vec_string_with_clip;
85    pub mod read_lines_into_vec_string_with_trim;
86}
87pub mod path {
88    pub mod read_lines_into_string;
89    pub mod read_lines_into_string_with_clip;
90    pub mod read_lines_into_string_with_trim;
91    pub mod read_lines_into_vec_string;
92    pub mod read_lines_into_vec_string_with_clip;
93    pub mod read_lines_into_vec_string_with_trim;
94}