read_lines_into
file_into_string Rust crate to read lines of a text file into a string or vector of strings
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (8.6%) to scientific vocabulary
Repository
file_into_string Rust crate to read lines of a text file into a string or vector of strings
Basic Info
- Host: GitHub
- Owner: SixArm
- Language: Rust
- Default Branch: main
- Size: 36.1 KB
Statistics
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
readlinesinto Rust crate
Read lines (from Path, File, BufRead) into a struct (String, Vec
Example:
```rust // Choose any existing text file let path = Path::new("example.txt");
// Read lines from the path's file into a string let string = path.readlinesinto_string().unwrap();
// Read lines from the path's file into a vector of strings let strings = path.readlinesintovecstring().unwrap(); ```
Install
Add dependency:
toml
[dependencies]
read_lines_into = "*"
Notes
These functions deliberately preserve line endings,
which are \n newlines and \r carriage returns.
These functions use buffered readers for efficiency.
These functions are written to be easy to understand, so you can copy them into your own code if you wish.
If you're reading very large files, then you may prefer to write your own code to process each line as it's read.
Line endings using LF and CRLF
Unix systems typically end text lines with \n LINE FEED (LF).
Windows systems typically end text lines with \r CARRIAGE RETURN (CR)
then and \n LINE FEED (LF).
FAQ
Why use this instead of the Rust BufRead lines() function?
Because we have use cases where we must preserve line endings.
Why publish this as a crate?
Because we want to make it easy to use, and easy to show as examples for developers who are learning how to program using Rust.
What are alternatives to consider?
Rust std::io::BufRead and its function lines().
Rust std::include_str and its macro include_string!.
Rust crate load_file and its macro load_str!.
Rust std::fs::read_to_string(file_name).unwrap().lines().
Tracking
- Project: read-lines-into-rust-crate
- Version: 1.0.0
- Created: 2022-10-01T22:58:34Z
- Updated: 2022-10-14T01:07:18Z
- Website: https://github.com/sixarm/read-lines-into-rust-crate
- Contact: Joel Parker Henderson joel@joelparkerhenderson.com
- License: MIT OR Apache-2.0 OR GPL-2.0 OR GPL-3.0
Owner
- Name: SixArm
- Login: SixArm
- Kind: organization
- Email: sixarm@sixarm.com
- Location: San Francisco
- Website: http://sixarm.com
- Twitter: sixarm
- Repositories: 580
- Profile: https://github.com/SixArm
SixArm Software
Citation (CITATION.cff)
cff-version: 1.2.0
title: read_lines_into Rust crate
message: >-
If you use this work and you want to cite it,
then you can use the metadata from this file.
type: software
authors:
- given-names: Joel Parker
family-names: Henderson
email: joel@joelparkerhenderson.com
affiliation: joelparkerhenderson.com
orcid: 'https://orcid.org/0009-0000-4681-282X'
identifiers:
- type: url
value: 'https://github.com/SixArm/read-lines-into-rust-crate/'
description: read_lines_into Rust crate
repository-code: 'https://github.com/SixArm/read-lines-into-rust-crate/'
abstract: >-
read_lines_into Rust crate
license: See license file
GitHub Events
Total
- Push event: 1
Last Year
- Push event: 1
Committers
Last synced: 12 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Joel Parker Henderson | j****l@j****m | 18 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 7 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cargo 1,474 total
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 1
- Total maintainers: 1
crates.io: read_lines_into
Read lines (from a Path, File, etc.) into a struct (a String, a Vec<String>), and with various ways to handle line endings and whitespace.
- Documentation: https://docs.rs/read_lines_into/
- License: MIT OR Apache-2.0 OR GPL-2.0 OR GPL-3.0
-
Latest release: 2.0.0
published over 3 years ago