{"id":17772129,"url":"https://github.com/dranikpg/rcin","last_synced_at":"2025-07-04T14:37:59.604Z","repository":{"id":62443704,"uuid":"249781168","full_name":"dranikpg/rcin","owner":"dranikpg","description":"Rust cin like input","archived":false,"fork":false,"pushed_at":"2020-03-29T17:50:26.000Z","size":17,"stargazers_count":4,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T16:56:01.814Z","etag":null,"topics":["rust"],"latest_commit_sha":null,"homepage":"","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/dranikpg.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-03-24T18:02:46.000Z","updated_at":"2022-08-12T12:32:14.000Z","dependencies_parsed_at":"2022-11-01T22:03:19.256Z","dependency_job_id":null,"html_url":"https://github.com/dranikpg/rcin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dranikpg%2Frcin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dranikpg%2Frcin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dranikpg%2Frcin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dranikpg%2Frcin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dranikpg","download_url":"https://codeload.github.com/dranikpg/rcin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250150775,"owners_count":21383221,"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","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":["rust"],"created_at":"2024-10-26T21:38:03.982Z","updated_at":"2025-04-21T23:31:43.258Z","avatar_url":"https://github.com/dranikpg.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":" \nInput crate that mimics c++ cin/ifstream\n\nRcin is great for prototyping and offers one crucial advantage over the classical\nBufReader approach. The only methods of BufRead/Read that work with strings are `read_to_string`\nand `read_line`, which can be unusable if a big file consists only of one or a few lines.\n\nIn contrast to similar input streams for rust, rcin can extract single characters.\n\nRcin also includes a static wrapper over stdin\n\n## Examples\nTo read from stdin\n``` rust\n    \n    let mut i = rin.read().unwrap_or(2020); // read any type that implements FromString\n    \n    while rin \u003e\u003e \u0026mut i{ // c++ style operator overload\n        println!(\"{}\", i);\n    }\n    \n    cin.read_line(); // read a line\n```\nTo read a file or any source that implements Read\n``` rust\n    let f = File::open(\"test.txt\").unwrap();\n    let mut reader = RInStream::from_file(f); // create RInStream instance\n    reader.skip_line();                       // skip first line\n    while reader.valid(){                     // while there are no errors from the source\n        match reader.read::\u003ci32\u003e(){           // read i32\n            Some(v) =\u003e (),\n            None =\u003e ()\n        }\n    }\n```\n## Inner mechanics\nThe inner stream buffers the source data exactly like BufRead with the same default buffer size,\nbut then tries to extract valid utf8 chars from the byte sequence. \n\nUtf8 offers many whitespaces, however the most used ones consist only of a single byte(tab, \nspace, ...). If any further versions will exist, they might leave out support for uncommon whitespaces, \nto speed up the parsing process and use the builtin utf8 parser. This also means that such streams won't be \nable to read the data char by char efficiently.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdranikpg%2Frcin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdranikpg%2Frcin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdranikpg%2Frcin/lists"}