{"id":20887934,"url":"https://github.com/canop/char_reader","last_synced_at":"2025-10-09T06:07:52.439Z","repository":{"id":43519312,"uuid":"310035485","full_name":"Canop/char_reader","owner":"Canop","description":"A buffered char reader for rust, not breaking on wild contents","archived":false,"fork":false,"pushed_at":"2022-01-28T09:43:51.000Z","size":7,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-07T11:44:11.164Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Canop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-04T15:00:49.000Z","updated_at":"2025-06-13T20:37:53.000Z","dependencies_parsed_at":"2022-08-28T11:22:57.771Z","dependency_job_id":null,"html_url":"https://github.com/Canop/char_reader","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Canop/char_reader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fchar_reader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fchar_reader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fchar_reader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fchar_reader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Canop","download_url":"https://codeload.github.com/Canop/char_reader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Canop%2Fchar_reader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000854,"owners_count":26082950,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T08:23:24.099Z","updated_at":"2025-10-09T06:07:52.420Z","avatar_url":"https://github.com/Canop.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![MIT][s2]][l2] [![Latest Version][s1]][l1] [![docs][s3]][l3] [![Chat on Miaou][s4]][l4]\n\n[s1]: https://img.shields.io/crates/v/char_reader.svg\n[l1]: https://crates.io/crates/char_reader\n\n[s2]: https://img.shields.io/badge/license-MIT-blue.svg\n[l2]: LICENSE\n\n[s3]: https://docs.rs/char_reader/badge.svg\n[l3]: https://docs.rs/char_reader/\n\n[s4]: https://miaou.dystroy.org/static/shields/room.svg\n[l4]: https://miaou.dystroy.org/3\n\nBufRead's read_line may be a problem when you need performance and safety on unvetted streams:\n\nYou may wait forever or get an out of memory panic if there's no newline in the stream.\nAnd even if there's one, it may be way past what you need: you'll have to keep everything in memory just to get to the start of the following line.\n\n`CharReader` is a buffered reader fixing those problems.\n\n* you can read lines without choking on an infinite stream without newlines\n* you can read lines and not store more than necessary if you just want the beginning\n* there's a `next_char` function to read only one char\n\nIt's suitable when you'd like to read UTF8 lines and aren't sure the data are kind enough.\n\nWhen reading a line, you pass two parameters:\n\n* the max number of chars you want to get (rest of line will be dropped)\n* the max number of chars before giving out with an error (thus protecting against infinite streams)\n\nAll errors are `io::Error`:\n\n* UTF8 errors are of kind `InvalidData`\n* Lines exceeding your threshold are of kind `Other`\n\n**Alternative:** If you know in advance how many lines you'd need and you always want whole lines, the standard `take` method of `BufReader` protects you against memory overflows.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanop%2Fchar_reader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcanop%2Fchar_reader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanop%2Fchar_reader/lists"}