dylanhart / ulid-rs

This is a Rust implementation of the ulid project
https://crates.io/crates/ulid
MIT License
389 stars 37 forks source link

base32::EncodingError does not implement std::fmt::Display #1

Closed lunemec closed 7 years ago

lunemec commented 7 years ago

Hi, love your library, however there is a tiny bug :)

This code does not compile:

let ulid = match Ulid::from_string(&file_ulid) {
        Ok(ulid) => ulid,
        Err(e) => {
            println!("Unable to parse ULID: {}", e);
            return
        }
    };
error[E0277]: the trait bound `ulid::EncodingError: std::fmt::Display` is not satisfied
  --> src/show.rs:97:50
   |
97 |             println!("Unable to parse ULID: {}", e);
   |                                                  ^ `ulid::EncodingError` cannot be formatted with the default formatter; try using `:?` instead if you are using a format string
   |
   = help: the trait `std::fmt::Display` is not implemented for `ulid::EncodingError`
   = note: required by `std::fmt::Display::fmt`

It works when formatting it with {:?}, but all other std errors support fmt::Display trait.

dylanhart commented 7 years ago

Thank you for reporting this issue. It has been fixed and a new version has been published. If find any more issues or wish something was different don't hesitate to make another issue.

[dependencies]
ulid = "0.2.2"

Thanks