diff --git a/.scripts/internal-tests-0.sh b/.scripts/internal-tests-0.sh index cd04eee4..2c0f07fd 100755 --- a/.scripts/internal-tests-0.sh +++ b/.scripts/internal-tests-0.sh @@ -26,6 +26,8 @@ $rt test-with-features wtx fastrand $rt test-with-features wtx flate2 $rt test-with-features wtx foldhash $rt test-with-features wtx grpc +$rt test-with-features wtx grpc-client +$rt test-with-features wtx grpc-server $rt test-with-features wtx hashbrown $rt test-with-features wtx hmac $rt test-with-features wtx http-client-framework diff --git a/Cargo.lock b/Cargo.lock index 77e70251..b68a3524 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2367,7 +2367,7 @@ dependencies = [ [[package]] name = "wtx" -version = "0.24.0" +version = "0.25.0" dependencies = [ "aes-gcm 0.11.0-pre.2", "arbitrary", diff --git a/wtx-instances/Cargo.toml b/wtx-instances/Cargo.toml index 9c8e37ea..9e646d3f 100644 --- a/wtx-instances/Cargo.toml +++ b/wtx-instances/Cargo.toml @@ -52,12 +52,12 @@ required-features = ["wtx/client-api-framework", "wtx/http-client-framework", "w [[example]] name = "grpc-client" path = "generic-examples/grpc-client.rs" -required-features = ["grpc"] +required-features = ["grpc-client"] [[example]] name = "grpc-server" path = "generic-examples/grpc-server.rs" -required-features = ["grpc", "wtx/tokio-rustls"] +required-features = ["grpc-server", "wtx/tokio-rustls"] [[example]] name = "http-client-framework" diff --git a/wtx/Cargo.toml b/wtx/Cargo.toml index e4f304b7..3d3973ff 100644 --- a/wtx/Cargo.toml +++ b/wtx/Cargo.toml @@ -58,14 +58,16 @@ executor = [] fastrand = ["dep:fastrand"] flate2 = ["dep:flate2"] foldhash = ["dep:foldhash", "hashbrown?/default-hasher"] -grpc = ["data-transformation", "http-client-framework", "http-server-framework"] +grpc = ["data-transformation"] +grpc-client = ["grpc", "http-client-framework"] +grpc-server = ["grpc", "http-server-framework"] hashbrown = ["dep:hashbrown"] hmac = ["dep:hmac"] http = [] http-client-framework = ["http2", "pool", "std"] http-cookie = ["chrono/alloc", "http"] http-cookie-secure = ["aes-gcm/aes", "aes-gcm/alloc", "base64", "digest", "http-cookie"] -http-server-framework = ["http2", "tokio"] +http-server-framework = ["http2"] http-session = ["chrono/serde", "http-cookie-secure", "serde_json"] http2 = ["foldhash", "hashbrown", "http"] httparse = ["dep:httparse"] @@ -151,7 +153,7 @@ name = "wtx" readme = "README.md" repository = "https://github.com/c410-f3r/wtx" rust-version = "1.82" -version = "0.24.0" +version = "0.25.0" [package.metadata.docs.rs] all-features = true diff --git a/wtx/src/grpc.rs b/wtx/src/grpc.rs index 9fd575cc..407e23eb 100644 --- a/wtx/src/grpc.rs +++ b/wtx/src/grpc.rs @@ -1,14 +1,18 @@ //! gRPC (gRPC Remote Procedure Calls) is a high performance remote procedure call (RPC) //! framework. +#[cfg(feature = "grpc-client")] mod client; mod grpc_manager; +#[cfg(feature = "grpc-server")] mod grpc_middleware; mod grpc_status_code; use crate::{data_transformation::dnsn::Serialize, misc::Vector}; +#[cfg(feature = "grpc-client")] pub use client::Client; pub use grpc_manager::GrpcManager; +#[cfg(feature = "grpc-server")] pub use grpc_middleware::GrpcMiddleware; pub use grpc_status_code::GrpcStatusCode; diff --git a/wtx/src/grpc/grpc_manager.rs b/wtx/src/grpc/grpc_manager.rs index a0defc09..6aea1b17 100644 --- a/wtx/src/grpc/grpc_manager.rs +++ b/wtx/src/grpc/grpc_manager.rs @@ -4,7 +4,6 @@ use crate::{ format::{VerbatimRequest, VerbatimResponse}, }, grpc::{serialize, GrpcStatusCode}, - http::server_framework::StreamAux, misc::Vector, }; @@ -50,7 +49,8 @@ impl GrpcManager { } } -impl StreamAux for GrpcManager +#[cfg(feature = "grpc-server")] +impl crate::http::server_framework::StreamAux for GrpcManager where DRSR: Default, { diff --git a/wtx/src/grpc/grpc_middleware.rs b/wtx/src/grpc/grpc_middleware.rs index 0c3b2b02..ea6eef96 100644 --- a/wtx/src/grpc/grpc_middleware.rs +++ b/wtx/src/grpc/grpc_middleware.rs @@ -39,7 +39,7 @@ where is_sensitive: false, is_trailer: true, name: "grpc-status", - value: [stream_aux.status_code_mut().number_as_str().as_bytes()].into_iter(), + value: [stream_aux.status_code_mut()._number_as_str().as_bytes()].into_iter(), }, ])?; Ok(ControlFlow::Continue(())) diff --git a/wtx/src/grpc/grpc_status_code.rs b/wtx/src/grpc/grpc_status_code.rs index 555d629b..cb3fa0b6 100644 --- a/wtx/src/grpc/grpc_status_code.rs +++ b/wtx/src/grpc/grpc_status_code.rs @@ -42,7 +42,7 @@ pub enum GrpcStatusCode { impl GrpcStatusCode { #[inline] - pub(crate) fn number_as_str(self) -> &'static str { + pub(crate) fn _number_as_str(self) -> &'static str { match self { GrpcStatusCode::Ok => "0", GrpcStatusCode::Cancelled => "1", diff --git a/wtx/src/http/optioned_server/http2_tokio.rs b/wtx/src/http/optioned_server/http2_tokio.rs index e3f6d583..4492385e 100644 --- a/wtx/src/http/optioned_server/http2_tokio.rs +++ b/wtx/src/http/optioned_server/http2_tokio.rs @@ -32,8 +32,8 @@ impl OptionedServer { + Send + 'static, A::Future: Send, - CA: Clone + Send + 'static, ACPT: Send + 'static, + CA: Clone + Send + 'static, E: From + Send + 'static, HA: Send + 'static, M: Clone