Skip to content

Commit 4366cb3

Browse files
committed
Add a README
1 parent 8a9fb98 commit 4366cb3

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[package]
22
name = "type-uuid"
33
version = "0.1.0"
4-
authors = ["Jacob Kiesel <kieseljake@gmail.com>", "David LeGare <dlegare.1001@gmail.com>"]
4+
authors = ["David LeGare <dlegare.1001@gmail.com>", "Jacob Kiesel <kieseljake@gmail.com>"]
55
edition = "2018"
66

77
description = "Safe, stable IDs for Rust types"
8+
readme = "./README.md"
89
documentation = "https://docs.rs/type-uuid"
910
repository = "https://github.com/randomPoison/type-uuid"
1011
license = "Apache-2.0 OR MIT"

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,28 @@
11
# type-uuid
2+
3+
This crate provides a way to specify a stable, unique identifier for Rust types.
4+
5+
## Assigning UUIDs to Types
6+
7+
This crate provides the [`TypeUuid`] trait, which defines a single const item
8+
`UUID`. This value is a byte array containing the raw bytes of the UUID for the
9+
type.
10+
11+
You will have to manually specify the UUID for any type implementing
12+
[`TypeUuid`], but this crate provides a custom derive to make that easy to do:
13+
14+
```rust
15+
use type_uuid::TypeUuid;
16+
17+
#[derive(TypeUuid)]
18+
#[uuid = "d4adfc76-f5f4-40b0-8e28-8a51a12f5e46"]
19+
struct MyType;
20+
```
21+
22+
While the derive handles the tedious work of converting the UUID into a byte
23+
array suitable for use with the [`TypeUuid`] trait, you'll still need to
24+
generate a valid UUID in order to assign it to your type. To do so, we
25+
recommend using https://www.uuidgenerator.net, which provides a quick way
26+
generate new UUIDs that you can paste into your code.
27+
28+
[`TypeUuid`]: ./trait.TypeUuid.html

0 commit comments

Comments
 (0)