entity-rs: Library & macros for entity data structures
A simplistic framework based on TAO, Facebook's distributed database for Social Graph.
Requires Rust 1.46+. Without entity_macros
, may compile and run for
older versions of Rust.
Getting Started
Installation
Import Entity into your project by adding the following line to your
Cargo.toml. entity_macros
contains the macros needed to derive and/or
transform your data to be compatible with supported databases and queries.
[]
= "0.1"
For most use cases, you can import all features using the full
flag, or for
a more tailored experience can import individual features:
[]
= { = "0.1", = ["global", "macros", "inmemory_db"] }
Example of defining data
use *;
Feature Flags
Entity provides a few feature flags:
full
- Enables all features.global
- Enables use of a database stored as a global variable, providing shortcuts in creating and retrieving ents.macros
- Enables macros for deriving ents and exposing a cleaner declarative API for ents. (Importsentity_macros
directly)inmemory_db
- Enables the in-memory database for use with ent objects. This does not bring inserde-1
by default, but including that feature will also support persisting the database to the filesystem.sled_db
- Enables the sled database for use with ent objects. Because of the nature of sled, this will also pull inserde-1
.serde-1
- Provides serde serialization module and associated functionality for ents through the use of typetag. This will require that all ents implement Serialize and Deserialize.- Requires
serde
andtypetag
to be included in dependencies.
- Requires