@@ -7,8 +7,13 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
crunch-traits.workspace = true
|
||||
crunch-file.workspace = true
|
||||
|
||||
anyhow.workspace = true
|
||||
tracing.workspace = true
|
||||
tokio.workspace = true
|
||||
async-trait.workspace = true
|
||||
prost.workspace = true
|
||||
prost-types.workspace = true
|
||||
prost-build.workspace = true
|
||||
bytes.workspace = true
|
||||
|
@@ -1,14 +1,15 @@
|
||||
pub fn add(left: usize, right: usize) -> usize {
|
||||
left + right
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[tokio::test]
|
||||
async fn test_can_generate_output_rust() {
|
||||
let proto_spec = r#"
|
||||
syntax = "proto3";
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = add(2, 2);
|
||||
assert_eq!(result, 4);
|
||||
package test.can.generate.output.rust;
|
||||
|
||||
message MyEvent {
|
||||
string name = 1;
|
||||
}
|
||||
"#;
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +0,0 @@
|
||||
[package]
|
||||
name = "test-bin"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
crunch-envelope.workspace = true
|
@@ -1,27 +0,0 @@
|
||||
fn main() {
|
||||
#[no_mangle]
|
||||
fn envelope_capnp_benchmark(content: &[u8]) {
|
||||
let out = crunch_envelope::wrap("some-domain", "some-entity", content);
|
||||
|
||||
let out = crunch_envelope::unwrap(&out).expect("to be able to unwrap capnp message");
|
||||
|
||||
println!("{:?}", out.1);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
fn envelope_json_benchmark(content: &[u8]) {
|
||||
let out = crunch_envelope::json::wrap("some-domain", "some-entity", content);
|
||||
|
||||
let out = crunch_envelope::json::unwrap(&out).expect("to be able to unwrap capnp message");
|
||||
|
||||
println!("{:?}", out.1);
|
||||
}
|
||||
|
||||
let large_content: [u8; 1000000] = [0; 1000000];
|
||||
|
||||
envelope_capnp_benchmark(&large_content);
|
||||
|
||||
envelope_json_benchmark(&large_content);
|
||||
|
||||
println!("done")
|
||||
}
|
Reference in New Issue
Block a user