Templates
Protobuf encoded objects can be used to create entity instances thorough
templates using the Entity type try_from implementation for creating
new instances from values of type alacrity_pb::tpl::EntityPrototype.
This is intended to be used from user implementations of gRPC (or other high level transportation layers) that might accept Alacrity types to be sent through the wire. An example of how to use it could be as follows:
#![allow(unused)] fn main() { fn entity_handler(entity_prototype: &alacrity_pb::tpl::EntityPrototype) -> Entity { match Entity::try_from(entity_prototype) { Ok(entity) => entity, Err(e) => panic!(err), } } }
The complete protobuf definitions can be found in the alacrity-proto more information can be found in the link above.
📔 Note
How to wrap alacrity in order to make network services around it is beyond the aim of this guide.