Code Monkey home page Code Monkey logo

exun's People

Contributors

botahamec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

exun's Issues

Handling unexpected variants

In the image crate, there's an error type that looks like this:

pub enum ImageError {
    Decoding(DecodingError),
    Encoding(EncodingError),
    Parameter(ParameterError),
    Limits(LimitError),
    Unsupported(UnsupportedError),
    IoError(std::io::Error),
}

I expect it possible to see a DecodingError, but nothing else should be possible for my use. Perhaps we could find a way to make it easy to decode that. Here's the solution my project is using:

fn convert_image_decoding(e: image::ImageError) -> Expect<DecodingError> {
	if let image::ImageError::Decoding(de) = e {
		Expected(de.into())
	} else {
		Unexpected(e.into())
	}
}

let texture = image::load_from_memory_with_format(buf, format.into()).map_err(convert_image_decoding)?;

`RawUnexpected` constructor names

The two constructors for RawUnexpected are:

  • RawUnexpected::new: takes an Error
  • RawUnexpected::msg: takes a Display + Debug

I'm wondering if we'd like to change them to from_err and from_msg respectively, following the Rust API Guidelines. I used new and msg because that's what anyhow and eyre use.

Add `serde`

I'd like to see serde support in this crate. This would involve creating a new feature, which would be turned off by default. I can only see this being implemented for Exun. I'm open to suggestions if someone can think of a way to make it work on RawUnexpected or UnexpectedError.

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.