Skip to content

Commit

Permalink
Finish 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsided committed Apr 7, 2023
1 parent 839a93d commit 8ae7391
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
All notable changes to this project will be documented in this file.
This project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
## 0.2.0 - 2023-04-08

### Added

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shortguid"
version = "0.2.0-unstable"
version = "0.2.0"
edition = "2021"
license = "EUPL-1.2"
description = "Short URL-safe Base64 encoded UUIDs"
Expand Down
2 changes: 1 addition & 1 deletion fuzz/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
//! Provides short, URL-safe UUID representations.
//!
//! ```
//! # use shortguid::ShortGuid;
//! let short_guid_a = ShortGuid::try_parse("c9a646d3-9c61-4cb7-bfcd-ee2522c8f633").unwrap();
//! let short_guid_b = ShortGuid::try_parse("yaZG05xhTLe_ze4lIsj2Mw").unwrap();
//! assert_eq!(short_guid_a, "yaZG05xhTLe_ze4lIsj2Mw");
//! assert_eq!(short_guid_a, short_guid_b);
//! ```
use base64::{DecodeError, Engine};
use std::borrow::Borrow;
Expand Down Expand Up @@ -323,9 +331,14 @@ impl AsRef<[u8]> for ShortGuid {
}
}

/// A parsing error.
#[derive(Eq, PartialEq)]
pub enum ParseError {
/// The provided input had an invalid length.
/// The contained value is the actual size.
InvalidLength(usize),
/// The provided input had an invalid format.
/// The contained value is the underlying decoding error.
InvalidFormat(DecodeError),
}

Expand Down

0 comments on commit 8ae7391

Please sign in to comment.