Improve Rust SDK build flags / reduce dependencies.

This reduces the amount of dependencies in case not all features are
being used. E.g. tonic is only needed if using gRPC and pbjson,
pbjson-types and serde are only needed if using the JSON serialization.
This commit is contained in:
Orne Brocaar
2023-03-28 21:11:54 +01:00
parent 4917de2b32
commit 8fe0c7c6c2
7 changed files with 74 additions and 46 deletions

View File

@ -2,7 +2,8 @@ use std::error::Error;
use std::fmt;
use std::str::FromStr;
tonic::include_proto!("common/common");
include!(concat!(env!("OUT_DIR"), "/common/common.rs"));
#[cfg(feature = "json")]
include!(concat!(env!("OUT_DIR"), "/common/common.serde.rs"));
#[allow(clippy::from_over_into)]

3
api/rust/src/gw.rs vendored
View File

@ -2,7 +2,8 @@ use rand::Rng;
use std::error::Error;
use std::str::FromStr;
tonic::include_proto!("gw/gw");
include!(concat!(env!("OUT_DIR"), "/gw/gw.rs"));
#[cfg(feature = "json")]
include!(concat!(env!("OUT_DIR"), "/gw/gw.serde.rs"));
#[allow(clippy::from_over_into)]

View File

@ -1,4 +1,5 @@
tonic::include_proto!("integration/integration");
include!(concat!(env!("OUT_DIR"), "/integration/integration.rs"));
#[cfg(feature = "json")]
include!(concat!(
env!("OUT_DIR"),
"/integration/integration.serde.rs"

View File

@ -1,2 +1,3 @@
tonic::include_proto!("internal/internal");
include!(concat!(env!("OUT_DIR"), "/internal/internal.rs"));
#[cfg(feature = "json")]
include!(concat!(env!("OUT_DIR"), "/internal/internal.serde.rs"));

View File

@ -1,2 +1,3 @@
tonic::include_proto!("meta/meta");
include!(concat!(env!("OUT_DIR"), "/meta/meta.rs"));
#[cfg(feature = "json")]
include!(concat!(env!("OUT_DIR"), "/meta/meta.serde.rs"));