Giter VIP home page Giter VIP logo

Comments (4)

nrc avatar nrc commented on August 26, 2024

We should probably provide both panicking and Result-returning versions of the function - maybe change read_str to expect_str and add a result-returning read_str?

If you're okay with that change, I'm happy to submit a pull request to both this and the xmas-elf crate.

That would be great thanks!

from zero.

kevinaboos avatar kevinaboos commented on August 26, 2024

In my forks, I have transformed it to Result-only since that's what I needed. I can submit a pull request and then someone else could add back in / create the expect versions. Or if I have time tomorrow I'll just add back in the panicking version too.

The one thing I don't love about my version is that is returns a Result where the Err type is &'static str instead of Utf8Error, which would be preferable imo. You can't create a Utf8Error object, so I couldn't figure out an easy way to return one.

from zero.

nrc avatar nrc commented on August 26, 2024

I'd prefer not to make a breaking change if we could avoid it (I realise my earlier proposal is breaking, but perhaps there is a naming scheme which is not).

If we're going to start using Result we should do it properly and introduce our own error type and use that rather than a string.

from zero.

kevinaboos avatar kevinaboos commented on August 26, 2024

Agreed. Quite busy this week, but once I get a spare moment I can refactor my forks into a non-breaking naming scheme, and then submit a pull request for each.

from zero.

Related Issues (2)

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.