diff options
author | hozan23 <hozan23@karyontech.net> | 2024-05-19 22:18:06 +0200 |
---|---|---|
committer | hozan23 <hozan23@karyontech.net> | 2024-05-19 22:18:06 +0200 |
commit | 1c520b20f70ddbdab885ec6c4bf5c87893a26eb4 (patch) | |
tree | 0e51b047e1df0b29fecdc5c39b200d5ecca520ef /jsonrpc | |
parent | 41ceed49285b4082477a83d7dda02fbfb3f96b2a (diff) |
jsonrpc: remove jsonrpc_internal crate
Diffstat (limited to 'jsonrpc')
-rw-r--r-- | jsonrpc/Cargo.toml | 3 | ||||
-rw-r--r-- | jsonrpc/jsonrpc_internal/Cargo.toml | 18 | ||||
-rw-r--r-- | jsonrpc/jsonrpc_macro/Cargo.toml | 9 | ||||
-rw-r--r-- | jsonrpc/jsonrpc_macro/src/lib.rs | 2 | ||||
-rw-r--r-- | jsonrpc/src/error.rs (renamed from jsonrpc/jsonrpc_internal/src/error.rs) | 0 | ||||
-rw-r--r-- | jsonrpc/src/lib.rs | 6 | ||||
-rw-r--r-- | jsonrpc/src/service.rs (renamed from jsonrpc/jsonrpc_internal/src/lib.rs) | 9 |
7 files changed, 12 insertions, 35 deletions
diff --git a/jsonrpc/Cargo.toml b/jsonrpc/Cargo.toml index e81ec10..cf49d6e 100644 --- a/jsonrpc/Cargo.toml +++ b/jsonrpc/Cargo.toml @@ -8,7 +8,6 @@ default = ["smol"] smol = [ "karyon_core/smol", "karyon_net/smol", - "karyon_jsonrpc_internal/smol", "karyon_jsonrpc_macro/smol", "dep:futures-rustls", "async-tungstenite/async-std-runtime", @@ -16,7 +15,6 @@ smol = [ tokio = [ "karyon_core/tokio", "karyon_net/tokio", - "karyon_jsonrpc_internal/tokio", "karyon_jsonrpc_macro/tokio", "async-tungstenite/tokio-runtime", "dep:tokio-rustls", @@ -27,7 +25,6 @@ karyon_core = { workspace = true, default-features = false } karyon_net = { workspace = true, default-features = false } karyon_jsonrpc_macro = { path = "jsonrpc_macro", default-features = false } -karyon_jsonrpc_internal = { path = "jsonrpc_internal", default-features = false } log = "0.4.21" rand = "0.8.5" diff --git a/jsonrpc/jsonrpc_internal/Cargo.toml b/jsonrpc/jsonrpc_internal/Cargo.toml deleted file mode 100644 index 5a3acc4..0000000 --- a/jsonrpc/jsonrpc_internal/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -name = "karyon_jsonrpc_internal" -version.workspace = true -edition.workspace = true - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[features] -default = ["smol"] -smol = ["karyon_core/smol", "karyon_net/smol"] -tokio = ["karyon_core/tokio", "karyon_net/tokio"] - -[dependencies] -karyon_core = { workspace = true, default-features = false } -karyon_net = { workspace = true, default-features = false } - -serde_json = "1.0.114" -thiserror = "1.0.58" diff --git a/jsonrpc/jsonrpc_macro/Cargo.toml b/jsonrpc/jsonrpc_macro/Cargo.toml index 17140c5..f0af550 100644 --- a/jsonrpc/jsonrpc_macro/Cargo.toml +++ b/jsonrpc/jsonrpc_macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "karyon_jsonrpc_macro" -version.workspace = true +version.workspace = true edition.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -10,15 +10,12 @@ proc-macro = true [features] default = ["smol"] -smol = ["karyon_jsonrpc_internal/smol"] -tokio = ["karyon_jsonrpc_internal/tokio"] +smol = [] +tokio = [] [dependencies] -karyon_jsonrpc_internal = { path = "../jsonrpc_internal", default-features = false } - proc-macro2 = "1.0" quote = "1.0" syn = { version = "1.0", features = ["full"] } serde_json = "1.0.114" - diff --git a/jsonrpc/jsonrpc_macro/src/lib.rs b/jsonrpc/jsonrpc_macro/src/lib.rs index f2015d4..c3d51e8 100644 --- a/jsonrpc/jsonrpc_macro/src/lib.rs +++ b/jsonrpc/jsonrpc_macro/src/lib.rs @@ -39,7 +39,7 @@ pub fn rpc_impl(_attr: TokenStream, item: TokenStream) -> TokenStream { let item2: TokenStream2 = item.into(); let quoted = quote! { - karyon_jsonrpc_internal::impl_rpc_service!(#self_ty, #(#methods),*); + karyon_jsonrpc::impl_rpc_service!(#self_ty, #(#methods),*); #item2 }; diff --git a/jsonrpc/jsonrpc_internal/src/error.rs b/jsonrpc/src/error.rs index 7f89729..7f89729 100644 --- a/jsonrpc/jsonrpc_internal/src/error.rs +++ b/jsonrpc/src/error.rs diff --git a/jsonrpc/src/lib.rs b/jsonrpc/src/lib.rs index 4ec03cc..3062512 100644 --- a/jsonrpc/src/lib.rs +++ b/jsonrpc/src/lib.rs @@ -68,13 +68,15 @@ mod client; mod codec; +mod error; pub mod message; mod server; +mod service; pub use client::Client; pub use server::Server; -pub use karyon_jsonrpc_internal::{impl_rpc_service, RPCMethod, RPCService}; -pub use karyon_jsonrpc_internal::{Error, Result}; +pub use error::{Error, Result}; pub use karyon_jsonrpc_macro::rpc_impl; pub use karyon_net::Endpoint; +pub use service::{RPCMethod, RPCService}; diff --git a/jsonrpc/jsonrpc_internal/src/lib.rs b/jsonrpc/src/service.rs index 95af82a..4c8c4b8 100644 --- a/jsonrpc/jsonrpc_internal/src/lib.rs +++ b/jsonrpc/src/service.rs @@ -1,7 +1,6 @@ -mod error; use std::{future::Future, pin::Pin}; -pub use error::{Error, Result}; +use crate::Result; /// Represents the RPC method pub type RPCMethod<'a> = Box<dyn Fn(serde_json::Value) -> RPCMethodOutput<'a> + Send + 'a>; @@ -21,7 +20,7 @@ pub trait RPCService: Sync + Send { /// ``` /// use serde_json::Value; /// -/// use karyon_jsonrpc_internal::{Error, impl_rpc_service}; +/// use karyon_jsonrpc::{Error, impl_rpc_service}; /// /// struct Hello {} /// @@ -41,11 +40,11 @@ pub trait RPCService: Sync + Send { #[macro_export] macro_rules! impl_rpc_service { ($t:ty, $($m:ident),*) => { - impl karyon_jsonrpc_internal::RPCService for $t { + impl karyon_jsonrpc::RPCService for $t { fn get_method<'a>( &'a self, name: &'a str - ) -> Option<karyon_jsonrpc_internal::RPCMethod> { + ) -> Option<karyon_jsonrpc::RPCMethod> { match name { $( stringify!($m) => { |