File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " type-uuid"
3
3
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>" ]
5
5
edition = " 2018"
6
6
7
7
description = " Safe, stable IDs for Rust types"
8
+ readme = " ./README.md"
8
9
documentation = " https://docs.rs/type-uuid"
9
10
repository = " https://github.com/randomPoison/type-uuid"
10
11
license = " Apache-2.0 OR MIT"
Original file line number Diff line number Diff line change 1
1
# 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
You can’t perform that action at this time.
0 commit comments