cloudwego / pilota Goto Github PK
View Code? Open in Web Editor NEWA thrift and protobuf implementation in pure rust with high performance and extensibility.
Home Page: https://crates.io/crates/pilota
License: Apache License 2.0
A thrift and protobuf implementation in pure rust with high performance and extensibility.
Home Page: https://crates.io/crates/pilota
License: Apache License 2.0
Right now in pilota, when I wrote like this:
struct A {
1: required map<i32, string> m,
}
It will generate:
pub struct A {
pub m: ::std::collections::HashMap<i32, ::pilota::FastStr>,
}
And there is no other way to generate code like followings as pilota.rust_type
annotation cannot work on container type.
pub struct A {
pub m: ::std::collections::HashMap<i32, String>,
}
Error when using plug-in
│ ├── pilota v0.8.1
│ ├── pilota v0.8.1 ()
├── pilota v0.8.1 ()
│ ├── pilota v0.8.1 (*)
│ ├── pilota-build v0.8.4
│ │ ├── pilota-thrift-parser v0.4.2
inux codespaces-0bb6e8 5.15.0-1041-azure #48-Ubuntu SMP Tue Jun 20 20:34:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
│ ├── volo v0.5.5
│ └── volo-grpc v0.6.0
│ └── volo v0.5.5 ()
│ └── volo-gen v0.1.0 (/workspaces/semen-sinapis/volo-gen)
│ ├── volo v0.5.5 ()
│ └── volo-grpc v0.6.0 ()
│ └── volo-build v0.6.2
│ ├── volo v0.5.5 ()
├── volo v0.5.5 ()
├── volo-gen v0.1.0 (/workspaces/semen-sinapis/volo-gen) ()
└── volo-grpc v0.6.0 (*)
When I use volo grpc, the build encounters an error,Adding the serde plug-in to the build.rs
file will result in an error.
volo-gen/build.rs
fn main() {
volo_build::ConfigBuilder::default().plugin(volo_build::plugin::SerdePlugin).write().unwrap();
}
The error message is as follows:
error[E0463]: can't find crate for serde
--> /workspaces/semen-sinapis/target/debug/build/volo-gen-b77b2808dfb60bc8/out/volo_gen.rs:11615:13
|
11615 | ::pilota::serde::Deserialize,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= note: this error originates in the derive macro ::pilota::serde::Deserialize
(in Nightly builds, run with -Z macro-backtrace for more info)
Currently only LinkedBytes supports zerocopy, but the length calculation can't be specialized for LinkedBytes.
This relies on rust-lang/rust#31844, when this is stabilized, we can fix the problem.
Should also support corresponding read/write method in TProtocol.
We can switch to the official protobuf-parse instead of our own protobuf-parse2 when stepancheg/rust-protobuf#646 is fixed.
汇总目前 pilota build 支持的 thrift annotations 以及作用, 需要在 https://github.com/cloudwego/cloudwego.github.io/tree/main/content/zh/docs/pilota/guide 下新建文档说明
Can pilota.rust_wrapper_arc
annotation support wrapper Arc like this:
struct A {
}
struct B {
1: required list<string> a(pilota.rust_wrapper_arc="inner"),
2: required list<string> b(pilota.rust_wrapper_arc="outer"),
}
Generated:
pub struct A {}
pub struct B {
a: ::std::collections::Vec<::std::sync::Arc<::pilota::FastStr>>,
b: ::std::sync::Arc<::std::collections::Vec<::pilota::FastStr>>,
}
需要在https://github.com/cloudwego/cloudwego.github.io/tree/main/content/zh/docs/pilota/guide 下增加文档,以及在examples 目录下增加示例
The latest thrift version has added support for the uuid
type.
We are always interested in finding out who is using Pilota, what attracted you to using it, how we can listen to your needs and if you are interested, help promote your organization.
Submit a comment in this issue and include the following information:
Organization/Company: ByteDance
Website: https://www.bytedance.com
Country: Global
Contact: [email protected]
Usage scenario: Using Pilota to build large scale Cloud Native applications
Status: Production
Thank you very much!
enum A {
A
AB
ABC
}
需要生成一个这样的as_str
方法
enum A {
A,
AB,
ABC,
}
impl A {
pub fn as_str(self) -> &'static str {
match self {
A::A => "A",
A::AB => "AB",
A::ABC => "ABC",
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.