(I decided to open a single PR for both features, let me know if you'd prefer separate PRs)
This PR adds:
serde as an optional dependency.
When enabled, Serialize and Deserialize are implemented for Ulids through their Crockford 26-char string representation.
Plus, a convenience serialization module ulid::serde::ulid_as_u128 that can be used to serialize directly through the inner u128 instead of a string.
uuid as an optional dependency.
When enabled, it implements From<Ulid> for Uuid and From<Uuid> for Ulid. Both go though the types' inner u128 representations and should be infallible.
Plus, when serde is also enabled, a convenience serialization module ulid::serde::ulid_as_uuid that can be used to serialize the ULID as a UUID string (and vice-versa). This is a bit of a niche feature, but it comes in handy when you're working with, say, a stringly-typed REST API that expects UUID-formatted identifiers, but one's using ULIDs internally.
A section to the README.md describing the new features.
(I decided to open a single PR for both features, let me know if you'd prefer separate PRs)
This PR adds:
serde
as an optional dependency.When enabled,
Serialize
andDeserialize
are implemented forUlid
s through their Crockford 26-char string representation.ulid::serde::ulid_as_u128
that can be used to serialize directly through the inneru128
instead of a string.uuid
as an optional dependency.When enabled, it implements
From<Ulid> for Uuid
andFrom<Uuid> for Ulid
. Both go though the types' inneru128
representations and should be infallible.serde
is also enabled, a convenience serialization moduleulid::serde::ulid_as_uuid
that can be used to serialize the ULID as a UUID string (and vice-versa). This is a bit of a niche feature, but it comes in handy when you're working with, say, a stringly-typed REST API that expects UUID-formatted identifiers, but one's using ULIDs internally.README.md
describing the new features.Closes #23.