From 8cdc44b24724acf7dd458e59f5ceed4af04574be Mon Sep 17 00:00:00 2001 From: hozan23 Date: Sat, 2 Dec 2023 05:10:33 +0300 Subject: Ensure uniform usage of the name `karyon` across all files --- jsonrpc/Cargo.toml | 6 +++--- jsonrpc/README.md | 4 ++-- jsonrpc/examples/client.rs | 2 +- jsonrpc/examples/server.rs | 2 +- jsonrpc/src/client.rs | 4 ++-- jsonrpc/src/codec.rs | 4 ++-- jsonrpc/src/error.rs | 6 +++--- jsonrpc/src/lib.rs | 4 ++-- jsonrpc/src/server.rs | 6 +++--- jsonrpc/src/service.rs | 6 +++--- 10 files changed, 22 insertions(+), 22 deletions(-) (limited to 'jsonrpc') diff --git a/jsonrpc/Cargo.toml b/jsonrpc/Cargo.toml index 12bea1a..4556708 100644 --- a/jsonrpc/Cargo.toml +++ b/jsonrpc/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "karyons_jsonrpc" +name = "karyon_jsonrpc" version.workspace = true edition.workspace = true [dependencies] -karyons_core.workspace = true -karyons_net.workspace = true +karyon_core.workspace = true +karyon_net.workspace = true smol = "1.3.0" log = "0.4.20" diff --git a/jsonrpc/README.md b/jsonrpc/README.md index f7ee641..af7dfe2 100644 --- a/jsonrpc/README.md +++ b/jsonrpc/README.md @@ -1,4 +1,4 @@ -# karyons jsonrpc +# karyon jsonrpc A fast and lightweight async implementation of [JSON-RPC 2.0](https://www.jsonrpc.org/specification), supporting the Tcp and Unix protocols. @@ -11,7 +11,7 @@ use std::sync::Arc; use serde_json::Value; use smol::net::{TcpStream, TcpListener}; -use karyons_jsonrpc::{JsonRPCError, Server, Client, register_service, ServerConfig, ClientConfig}; +use karyon_jsonrpc::{JsonRPCError, Server, Client, register_service, ServerConfig, ClientConfig}; struct HelloWorld {} diff --git a/jsonrpc/examples/client.rs b/jsonrpc/examples/client.rs index b28760d..2c8cf83 100644 --- a/jsonrpc/examples/client.rs +++ b/jsonrpc/examples/client.rs @@ -1,7 +1,7 @@ use serde::{Deserialize, Serialize}; use smol::net::TcpStream; -use karyons_jsonrpc::{Client, ClientConfig}; +use karyon_jsonrpc::{Client, ClientConfig}; #[derive(Deserialize, Serialize)] struct Req { diff --git a/jsonrpc/examples/server.rs b/jsonrpc/examples/server.rs index b09232f..6953433 100644 --- a/jsonrpc/examples/server.rs +++ b/jsonrpc/examples/server.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; use serde_json::Value; use smol::net::TcpListener; -use karyons_jsonrpc::{register_service, JsonRPCError, Server, ServerConfig}; +use karyon_jsonrpc::{register_service, JsonRPCError, Server, ServerConfig}; struct Calc { version: String, diff --git a/jsonrpc/src/client.rs b/jsonrpc/src/client.rs index 69c2e6d..8e413e2 100644 --- a/jsonrpc/src/client.rs +++ b/jsonrpc/src/client.rs @@ -1,8 +1,8 @@ use log::debug; use serde::{de::DeserializeOwned, Serialize}; -use karyons_core::util::random_32; -use karyons_net::ToConn; +use karyon_core::util::random_32; +use karyon_net::ToConn; use crate::{ codec::{Codec, CodecConfig}, diff --git a/jsonrpc/src/codec.rs b/jsonrpc/src/codec.rs index 5dac8da..451cdb4 100644 --- a/jsonrpc/src/codec.rs +++ b/jsonrpc/src/codec.rs @@ -1,7 +1,7 @@ use memchr::memchr; -use karyons_core::async_util::timeout; -use karyons_net::Conn; +use karyon_core::async_util::timeout; +use karyon_net::Conn; use crate::{Error, Result}; diff --git a/jsonrpc/src/error.rs b/jsonrpc/src/error.rs index 5437c6d..8bc8c49 100644 --- a/jsonrpc/src/error.rs +++ b/jsonrpc/src/error.rs @@ -2,7 +2,7 @@ use thiserror::Error as ThisError; pub type Result = std::result::Result; -/// Represents karyons's jsonrpc Error. +/// Represents karyon's jsonrpc Error. #[derive(ThisError, Debug)] pub enum Error { #[error(transparent)] @@ -27,8 +27,8 @@ pub enum Error { InvalidMsg(&'static str), #[error(transparent)] - KaryonsCore(#[from] karyons_core::error::Error), + KaryonCore(#[from] karyon_core::error::Error), #[error(transparent)] - KaryonsNet(#[from] karyons_net::NetError), + KaryonNet(#[from] karyon_net::NetError), } diff --git a/jsonrpc/src/lib.rs b/jsonrpc/src/lib.rs index da9047d..df66363 100644 --- a/jsonrpc/src/lib.rs +++ b/jsonrpc/src/lib.rs @@ -9,7 +9,7 @@ //! use serde_json::Value; //! use smol::net::{TcpStream, TcpListener}; //! -//! use karyons_jsonrpc::{JsonRPCError, Server, Client, register_service, ServerConfig, ClientConfig}; +//! use karyon_jsonrpc::{JsonRPCError, Server, Client, register_service, ServerConfig, ClientConfig}; //! //! struct HelloWorld {} //! @@ -63,7 +63,7 @@ pub use error::Error as JsonRPCError; pub use server::{Server, ServerConfig}; pub use service::{RPCMethod, RPCService}; -pub use karyons_net::Endpoint; +pub use karyon_net::Endpoint; const JSONRPC_VERSION: &str = "2.0"; use error::{Error, Result}; diff --git a/jsonrpc/src/server.rs b/jsonrpc/src/server.rs index 4f1bada..92920ad 100644 --- a/jsonrpc/src/server.rs +++ b/jsonrpc/src/server.rs @@ -3,12 +3,12 @@ use std::{collections::HashMap, sync::Arc}; use log::{debug, error, warn}; use smol::lock::RwLock; -use karyons_core::{ +use karyon_core::{ async_util::{TaskGroup, TaskResult}, Executor, }; -use karyons_net::{Conn, Listener, ToListener}; +use karyon_net::{Conn, Listener, ToListener}; use crate::{ codec::{Codec, CodecConfig}, @@ -44,7 +44,7 @@ impl<'a> Server<'a> { /// Returns the local endpoint. pub fn local_endpoint(&self) -> Result { - self.listener.local_endpoint().map_err(Error::KaryonsNet) + self.listener.local_endpoint().map_err(Error::KaryonNet) } /// Starts the RPC server diff --git a/jsonrpc/src/service.rs b/jsonrpc/src/service.rs index 62ec726..943442c 100644 --- a/jsonrpc/src/service.rs +++ b/jsonrpc/src/service.rs @@ -20,7 +20,7 @@ pub trait RPCService: Sync + Send { /// ``` /// use serde_json::Value; /// -/// use karyons_jsonrpc::{JsonRPCError, register_service}; +/// use karyon_jsonrpc::{JsonRPCError, register_service}; /// /// struct Hello {} /// @@ -36,11 +36,11 @@ pub trait RPCService: Sync + Send { #[macro_export] macro_rules! register_service { ($t:ty, $($m:ident),*) => { - impl karyons_jsonrpc::RPCService for $t { + impl karyon_jsonrpc::RPCService for $t { fn get_method<'a>( &'a self, name: &'a str - ) -> Option { + ) -> Option { match name { $( stringify!($m) => { -- cgit v1.2.3