Code Monkey home page Code Monkey logo

bytelines's Issues

Add other runtimes, remove Tokio from default features

There are many other popular runtimes besides Tokio, we should add modules for these runtimes too. The two in mind are smol and async_std but there are probably others.

At the same time all of these runtimes should be off by default, and opt-in via features in the dependencies. Obviously this will all be a major bump, so we can consider any changes in APIs here too.

Add iterator that includes offset

It would be great if there would be a function with identical usage, but that also includes the byte offset in the iterator item. I need this because i need to remove some characters from a specific line, but cant because the byte offset i have (from .take(n).fold(0, |count, v| count + v.len())) would not take into consideration the bytes of the actual newlines characters.

Add LICENSE file

There are many MIT variants out there and it would be very helpful if you would put specific one into the LICENSE file and release new version. This is basically requirement for packaging this crate in Fedora.

empty line without \r causes panic

use std::io;
extern crate bytelines;
use bytelines::*;

fn main() {
    let stdin = io::stdin();
    for _ in stdin.lock().byte_lines() {}
}
$ echo | cargo run
thread 'main' panicked at 'attempt to subtract with overflow', …/bytelines-2.2.1/src/lib.rs:129:36

And the line that panics is:

// also "pop" a leading \r
if self.buffer[n - 1] == b'\r' {

Documentation contains incorrect types

Apologies if I'm not understanding some Rust conventions but it seems to me that that the docs are misleading about the types yielded when iterating over lines. E.g.

// do something with the line, which is &[u8]

whereas really (AIUI) it's Result<&[u8], Error>. The same is true of several of the comments (and thus in the official docs on crates.io).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.