feat: fmt all

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2023-09-24 22:10:49 +02:00
parent ca7c0c5c09
commit 595e82c064
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394
4 changed files with 762 additions and 571 deletions

View File

@ -1,6 +1,6 @@
mod logging; mod logging;
use std::path::{PathBuf}; use std::path::PathBuf;
use anyhow::anyhow; use anyhow::anyhow;
use clap::{Args, Parser, Subcommand}; use clap::{Args, Parser, Subcommand};

File diff suppressed because it is too large Load Diff

View File

@ -16,8 +16,6 @@ pub struct Metadata {
} }
pub fn wrap<'a>(domain: &'a str, entity: &'a str, content: &'a [u8]) -> Vec<u8> { pub fn wrap<'a>(domain: &'a str, entity: &'a str, content: &'a [u8]) -> Vec<u8> {
serde_json::to_vec(&Envelope { serde_json::to_vec(&Envelope {
content: general_purpose::URL_SAFE_NO_PAD.encode(content), content: general_purpose::URL_SAFE_NO_PAD.encode(content),
metadata: Metadata { metadata: Metadata {

View File

@ -1,60 +1,64 @@
pub mod basic { pub mod basic {
pub mod includes { pub mod includes {
pub mod my_include { use prost::Message; pub mod my_include {
include!("basic.includes.my_include.rs"); use prost::Message;
include!("basic.includes.my_include.rs");
impl ::crunch::traits::Serializer for MyInclude { 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 MyInclude { 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(::crunch::errors::DeserializeError::ProtoErr)?; let output = Self::decode(raw.as_slice())
Ok(output) .map_err(::crunch::errors::DeserializeError::ProtoErr)?;
} Ok(output)
} }
}
impl crunch::traits::Event for MyInclude { 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",
entity_type: "my-entity-type", entity_type: "my-entity-type",
event_name: "my-event-name", event_name: "my-event-name",
} }
} }
} }
} }
} }
pub mod my_event { use prost::Message; pub mod my_event {
include!("basic.my_event.rs"); use prost::Message;
include!("basic.my_event.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 { impl ::crunch::traits::Deserializer for MyEvent {
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(::crunch::errors::DeserializeError::ProtoErr)?; let output = Self::decode(raw.as_slice())
Ok(output) .map_err(::crunch::errors::DeserializeError::ProtoErr)?;
} 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",
} }
} }
} }
} }
} }