dylanhart / ulid-rs

This is a Rust implementation of the ulid project

Home Page:https://crates.io/crates/ulid

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New features: serde support, and conversions to uuid

abreis opened this issue · comments

Hi, I wrote two new (optional) features in my own fork of ulid-rs, and I'd like to know if you'd welcome pull requests for either of them. They are:

  • serde: this pulls in serde and implements Serialize and Deserialize for Ulid. The 26-char representation is used by default, and I also wrote a module that can serialize as the inner primitive u128 by annotating structs with #[serde(with = "ulid_as_u128")];
  • uuid: this is a tiny convenience feature that pulls in the uuid crate and implements the conversions From<Uuid> for Ulid and From<Ulid> for Uuid, both infallible. These come in handy when interacting with systems that expect UUIDs.

These sound great. When making the PR can you put them behind non-default feature flags?