feat: without root
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
cd4cd35d0c
commit
adee7503c5
@ -62,9 +62,7 @@ impl Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
quote! {
|
quote! {
|
||||||
pub mod $(&self.segment) {
|
$(for tokens in child_tokens join ($['\r']) => $tokens)
|
||||||
$(for tokens in child_tokens join ($['\r']) => $tokens)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,54 +1,25 @@
|
|||||||
pub mod root {
|
pub mod basic {
|
||||||
pub mod basic {
|
pub mod includes {
|
||||||
pub mod includes {
|
pub mod my_include {
|
||||||
pub mod my_include {
|
|
||||||
use prost::Message;
|
|
||||||
include!("basic.includes.my_include.rs");
|
|
||||||
impl ::crunch::traits::Serializer for MyInclude {
|
|
||||||
fn serialize(&self) -> Result<Vec<u8>, ::crunch::errors::SerializeError> {
|
|
||||||
Ok(self.encode_to_vec())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl ::crunch::traits::Deserializer for MyInclude {
|
|
||||||
fn deserialize(raw: Vec<u8>) -> Result<Self, ::crunch::errors::DeserializeError>
|
|
||||||
where
|
|
||||||
Self: Sized,
|
|
||||||
{
|
|
||||||
let output = Self::decode(raw.as_slice()).map_err(|e| ::crunch::errors::DeserializeError::ProtoErr(e))?;
|
|
||||||
Ok(output)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl crunch::traits::Event for MyInclude {
|
|
||||||
fn event_info() -> ::crunch::traits::EventInfo {
|
|
||||||
::crunch::traits::EventInfo {
|
|
||||||
domain: "my-domain",
|
|
||||||
entity_type: "my-entity-type",
|
|
||||||
event_name: "my-event-name",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub mod my_event {
|
|
||||||
use prost::Message;
|
use prost::Message;
|
||||||
include!("basic.my_event.rs");
|
include!("basic.includes.my_include.rs");
|
||||||
impl ::crunch::traits::Serializer for MyEvent {
|
impl ::crunch::traits::Serializer for MyInclude {
|
||||||
fn serialize(&self) -> Result<Vec<u8>, ::crunch::errors::SerializeError> {
|
fn serialize(&self) -> Result<Vec<u8>, ::crunch::errors::SerializeError> {
|
||||||
Ok(self.encode_to_vec())
|
Ok(self.encode_to_vec())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl ::crunch::traits::Deserializer for MyEvent {
|
impl ::crunch::traits::Deserializer for MyInclude {
|
||||||
fn deserialize(raw: Vec<u8>) -> Result<Self, ::crunch::errors::DeserializeError>
|
fn deserialize(raw: Vec<u8>) -> Result<Self, ::crunch::errors::DeserializeError>
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
let output = Self::decode(raw.as_slice()).map_err(|e| ::crunch::errors::DeserializeError::ProtoErr(e))?;
|
let output = Self::decode(raw.as_slice())
|
||||||
|
.map_err(|e| ::crunch::errors::DeserializeError::ProtoErr(e))?;
|
||||||
Ok(output)
|
Ok(output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl crunch::traits::Event for MyEvent {
|
impl crunch::traits::Event for MyInclude {
|
||||||
fn event_info() -> ::crunch::traits::EventInfo {
|
fn event_info() -> ::crunch::traits::EventInfo {
|
||||||
::crunch::traits::EventInfo {
|
::crunch::traits::EventInfo {
|
||||||
domain: "my-domain",
|
domain: "my-domain",
|
||||||
@ -59,32 +30,62 @@ pub mod root {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub mod examples {
|
pub mod my_event {
|
||||||
pub mod example {
|
use prost::Message;
|
||||||
use prost::Message;
|
include!("basic.my_event.rs");
|
||||||
include!("examples.example.rs");
|
impl ::crunch::traits::Serializer for MyEvent {
|
||||||
impl ::crunch::traits::Serializer for MyEvent {
|
fn serialize(&self) -> Result<Vec<u8>, ::crunch::errors::SerializeError> {
|
||||||
fn serialize(&self) -> Result<Vec<u8>, ::crunch::errors::SerializeError> {
|
Ok(self.encode_to_vec())
|
||||||
Ok(self.encode_to_vec())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
impl ::crunch::traits::Deserializer for MyEvent {
|
}
|
||||||
fn deserialize(raw: Vec<u8>) -> Result<Self, ::crunch::errors::DeserializeError>
|
impl ::crunch::traits::Deserializer for MyEvent {
|
||||||
where
|
fn deserialize(raw: Vec<u8>) -> Result<Self, ::crunch::errors::DeserializeError>
|
||||||
Self: Sized,
|
where
|
||||||
{
|
Self: Sized,
|
||||||
let output = Self::decode(raw.as_slice()).map_err(|e| ::crunch::errors::DeserializeError::ProtoErr(e))?;
|
{
|
||||||
Ok(output)
|
let output = Self::decode(raw.as_slice())
|
||||||
}
|
.map_err(|e| ::crunch::errors::DeserializeError::ProtoErr(e))?;
|
||||||
|
Ok(output)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl crunch::traits::Event for MyEvent {
|
impl crunch::traits::Event for MyEvent {
|
||||||
fn event_info() -> ::crunch::traits::EventInfo {
|
fn event_info() -> ::crunch::traits::EventInfo {
|
||||||
::crunch::traits::EventInfo {
|
::crunch::traits::EventInfo {
|
||||||
domain: "my-domain",
|
domain: "my-domain",
|
||||||
entity_type: "my-entity-type",
|
entity_type: "my-entity-type",
|
||||||
event_name: "my-event-name",
|
event_name: "my-event-name",
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub mod examples {
|
||||||
|
pub mod example {
|
||||||
|
use prost::Message;
|
||||||
|
include!("examples.example.rs");
|
||||||
|
impl ::crunch::traits::Serializer for MyEvent {
|
||||||
|
fn serialize(&self) -> Result<Vec<u8>, ::crunch::errors::SerializeError> {
|
||||||
|
Ok(self.encode_to_vec())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl ::crunch::traits::Deserializer for MyEvent {
|
||||||
|
fn deserialize(raw: Vec<u8>) -> Result<Self, ::crunch::errors::DeserializeError>
|
||||||
|
where
|
||||||
|
Self: Sized,
|
||||||
|
{
|
||||||
|
let output = Self::decode(raw.as_slice())
|
||||||
|
.map_err(|e| ::crunch::errors::DeserializeError::ProtoErr(e))?;
|
||||||
|
Ok(output)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl crunch::traits::Event for MyEvent {
|
||||||
|
fn event_info() -> ::crunch::traits::EventInfo {
|
||||||
|
::crunch::traits::EventInfo {
|
||||||
|
domain: "my-domain",
|
||||||
|
entity_type: "my-entity-type",
|
||||||
|
event_name: "my-event-name",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user