Skip to content

TomGillen/legion_typeuuid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Legion Type Uuid

legion-typeuuid provides the SerializableTypeUuid type key, which can be used with legion's Registry to provide stable component type ID mappings for world serialization.

let mut registry = Registry::new();
let uuid = SerializableTypeUuid::parse_str("1d97d71a-76bf-41d1-94c3-fcaac8231f12");
registry.register::<Position>(uuid);

Feature Flags

type-uuid

Allows type UUIDs defined with the type-uuid crate to be used with SerializableTypeUuid.

#[derive(Serialize, Deserialize, TypeUuid)]
#[uuid = "1d97d71a-76bf-41d1-94c3-fcaac8231f12"]
struct Position;

let mut registry = Registry::new();
registry.register_auto_mapped::<Position>();

collect

Allows automatic component type registration with the register_serialize! macro and collect_registry() function. This feature requires your crate to also declare a dependency to the inventory crate.

#[derive(Serialize, Deserialize)]
struct Position;

register_serialize!(Position, "1d97d71a-76bf-41d1-94c3-fcaac8231f12");

let registry = collect_registry();

This can be used together with the type-uuid feature.

#[derive(Serialize, Deserialize, TypeUuid)]
#[uuid = "1d97d71a-76bf-41d1-94c3-fcaac8231f12"]
struct Position;

register_serialize!(Position);

let registry = collect_registry();

About

Stable component type IDs for legion world serialization

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages