Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Proto types#81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
flokli wants to merge2 commits intocel-rust:master
base:master
Choose a base branch
Loading
fromflokli:proto-types
Draft
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
add cel_interpreter::proto and proto feature flag
This adds the cel_interpreter::proto mod, exposing the cel.expr protobuftypes, as well as the necessary plumbing to generate the typedefinitions at compile time.The outcome can be best explored by invoking `cargo doc` with the`proto` feature enabled, and starting at the`cel_interpreter::proto::[Parsed]Expr` struct.
  • Loading branch information
@flokli
flokli committedSep 10, 2024
commit8419e0b8902dca69bec0249fc2986ffda1f9cc75
9 changes: 9 additions & 0 deletionsinterpreter/Cargo.toml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,11 +14,19 @@ thiserror = "1.0.40"
chrono = { version = "0.4.26", default-features = false, features = ["alloc"] }
nom = "7.1.3"
paste = "1.0.14"
prost = { version = "0.13", optional = true }
prost-types = { version = "0.13.2", optional = true }
prost-wkt = { version = "0.6", optional = true }
prost-wkt-types = { version = "0.6", optional = true }
serde = "1.0.196"
regex = "1.10.5"
serde_json = { version = "1.0.124", optional = true }
base64 = { version = "0.22.1", optional = true }

[build-dependencies]
prost-build = { version = "0.13", optional = true }
prost-wkt-build = { version = "0.6", optional = true }

[dev-dependencies]
criterion = { version = "0.5.1", features = ["html_reports"] }
serde_bytes = "0.11.14"
Expand All@@ -28,5 +36,6 @@ name = "runtime"
harness = false

[features]
proto = ["dep:prost", "dep:prost-types", "dep:prost-build", "dep:prost-wkt", "dep:prost-wkt-build", "dep:prost-wkt-types", "serde/derive"]
json = ["dep:base64", "dep:serde_json"]

30 changes: 30 additions & 0 deletionsinterpreter/build.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
use prost_wkt_build::*;
use std::{env, path::PathBuf};

fn main() {
let out = PathBuf::from(env::var("OUT_DIR").unwrap());
let descriptor_file = out.join("descriptors.bin");
let mut prost_build = prost_build::Config::new();
prost_build
.type_attribute(".", "#[derive(serde::Serialize,serde::Deserialize)]")
.extern_path(".google.protobuf.Any", "::prost_wkt_types::Any")
.extern_path(".google.protobuf.Duration", "::prost_wkt_types::Duration")
.extern_path(".google.protobuf.Timestamp", "::prost_wkt_types::Timestamp")
.extern_path(".google.protobuf.Value", "::prost_wkt_types::Value")
.file_descriptor_set_path(&descriptor_file)
.compile_protos(
&[
"../proto/cel/expr/syntax.proto",
"../proto/cel/expr/checked.proto",
"../proto/cel/expr/value.proto",
],
&["../proto/"],
)
.unwrap();

let descriptor_bytes = std::fs::read(descriptor_file).unwrap();

let descriptor = FileDescriptorSet::decode(&descriptor_bytes[..]).unwrap();

prost_wkt_build::add_serde(out, descriptor);
}
2 changes: 2 additions & 0 deletionsinterpreter/src/lib.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,6 +22,8 @@ pub use ser::to_value;

#[cfg(feature = "json")]
mod json;
#[cfg(feature = "proto")]
pub mod proto;
#[cfg(test)]
mod testing;

Expand Down
1 change: 1 addition & 0 deletionsinterpreter/src/proto.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
include!(concat!(env!("OUT_DIR"), "/cel.expr.rs"));

[8]ページ先頭

©2009-2025 Movatter.jp