mirror of
https://github.com/Start9Labs/rpc-toolkit.git
synced 2026-03-26 02:11:56 +00:00
reformat imports
This commit is contained in:
@@ -1,14 +1,14 @@
|
|||||||
use super::parse::*;
|
use std::collections::HashSet;
|
||||||
use super::*;
|
|
||||||
use proc_macro2::*;
|
use proc_macro2::*;
|
||||||
use quote::*;
|
use quote::*;
|
||||||
use std::collections::HashSet;
|
use syn::fold::Fold;
|
||||||
use syn::{
|
use syn::punctuated::Punctuated;
|
||||||
fold::Fold,
|
use syn::spanned::Spanned;
|
||||||
punctuated::Punctuated,
|
use syn::token::{Comma, Where};
|
||||||
spanned::Spanned,
|
|
||||||
token::{Comma, Where},
|
use super::parse::*;
|
||||||
};
|
use super::*;
|
||||||
|
|
||||||
fn build_app(name: LitStr, opt: &mut Options, params: &mut [ParamType]) -> TokenStream {
|
fn build_app(name: LitStr, opt: &mut Options, params: &mut [ParamType]) -> TokenStream {
|
||||||
let about = opt.common().about.clone().into_iter();
|
let about = opt.common().about.clone().into_iter();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use super::*;
|
|
||||||
use syn::spanned::Spanned;
|
use syn::spanned::Spanned;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
pub fn parse_command_attr(args: AttributeArgs) -> Result<Options> {
|
pub fn parse_command_attr(args: AttributeArgs) -> Result<Options> {
|
||||||
let mut opt = Options::Leaf(Default::default());
|
let mut opt = Options::Leaf(Default::default());
|
||||||
for arg in args {
|
for arg in args {
|
||||||
|
|||||||
@@ -15,4 +15,4 @@ pub use command::build::build as build_command;
|
|||||||
pub use rpc_server::build::build as build_rpc_server;
|
pub use rpc_server::build::build as build_rpc_server;
|
||||||
pub use rpc_server::RpcServerArgs;
|
pub use rpc_server::RpcServerArgs;
|
||||||
pub use run_cli::build::build as build_run_cli;
|
pub use run_cli::build::build as build_run_cli;
|
||||||
pub use run_cli::RunCliArgs;
|
pub use run_cli::RunCliArgs;
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
use super::*;
|
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
use syn::spanned::Spanned;
|
use syn::spanned::Spanned;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
pub fn build(args: RpcServerArgs) -> TokenStream {
|
pub fn build(args: RpcServerArgs) -> TokenStream {
|
||||||
let mut command = args.command;
|
let mut command = args.command;
|
||||||
let arguments = std::mem::replace(
|
let arguments = std::mem::replace(
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use super::*;
|
|
||||||
use syn::parse::{Parse, ParseStream};
|
use syn::parse::{Parse, ParseStream};
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
impl Parse for RpcServerArgs {
|
impl Parse for RpcServerArgs {
|
||||||
fn parse(input: ParseStream) -> Result<Self> {
|
fn parse(input: ParseStream) -> Result<Self> {
|
||||||
let command = input.parse()?;
|
let command = input.parse()?;
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
use super::*;
|
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
use syn::spanned::Spanned;
|
use syn::spanned::Spanned;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
pub fn build(args: RunCliArgs) -> TokenStream {
|
pub fn build(args: RunCliArgs) -> TokenStream {
|
||||||
let mut command_handler = args.command.clone();
|
let mut command_handler = args.command.clone();
|
||||||
let mut arguments = std::mem::replace(
|
let mut arguments = std::mem::replace(
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use super::*;
|
|
||||||
use syn::parse::{Parse, ParseStream};
|
use syn::parse::{Parse, ParseStream};
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
impl Parse for MakeSeed {
|
impl Parse for MakeSeed {
|
||||||
fn parse(input: ParseStream) -> Result<Self> {
|
fn parse(input: ParseStream) -> Result<Self> {
|
||||||
let matches_ident = input.parse()?;
|
let matches_ident = input.parse()?;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
|
use std::fmt::Display;
|
||||||
|
use std::io::Stdin;
|
||||||
|
use std::marker::PhantomData;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::{fmt::Display, io::Stdin, marker::PhantomData};
|
|
||||||
|
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
use hyper::Method;
|
use hyper::Method;
|
||||||
@@ -10,18 +12,21 @@ use yajrc::{GenericRpcMethod, Id, RpcError, RpcRequest, RpcResponse};
|
|||||||
use crate::Context;
|
use crate::Context;
|
||||||
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
|
pub use std::borrow::Cow;
|
||||||
|
pub use std::marker::PhantomData;
|
||||||
|
|
||||||
|
pub use clap::{App, AppSettings, Arg, ArgMatches};
|
||||||
|
pub use serde::{Deserialize, Serialize};
|
||||||
|
pub use serde_json::{from_value, to_value, Value};
|
||||||
|
pub use tokio::runtime::Runtime;
|
||||||
|
pub use tokio::task::spawn_blocking;
|
||||||
|
pub use yajrc::{self, RpcError};
|
||||||
|
|
||||||
pub use super::{
|
pub use super::{
|
||||||
call_remote, default_arg_parser, default_display, default_stdin_parser, make_phantom,
|
call_remote, default_arg_parser, default_display, default_stdin_parser, make_phantom,
|
||||||
match_types,
|
match_types,
|
||||||
};
|
};
|
||||||
pub use crate::Context;
|
pub use crate::Context;
|
||||||
pub use clap::{App, AppSettings, Arg, ArgMatches};
|
|
||||||
pub use serde::{Deserialize, Serialize};
|
|
||||||
pub use serde_json::{from_value, to_value, Value};
|
|
||||||
pub use std::borrow::Cow;
|
|
||||||
pub use std::marker::PhantomData;
|
|
||||||
pub use tokio::{runtime::Runtime, task::spawn_blocking};
|
|
||||||
pub use yajrc::{self, RpcError};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
use crate::SeedableContext;
|
use hyper::body::Buf;
|
||||||
use hyper::{
|
use hyper::server::conn::AddrIncoming;
|
||||||
body::Buf,
|
use hyper::server::{Builder, Server};
|
||||||
server::{conn::AddrIncoming, Builder, Server},
|
use hyper::{Body, Request, Response, StatusCode};
|
||||||
Body, Request, Response, StatusCode,
|
|
||||||
};
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use url::Host;
|
use url::Host;
|
||||||
use yajrc::{AnyRpcMethod, GenericRpcMethod, Id, RpcError, RpcRequest, RpcResponse};
|
use yajrc::{AnyRpcMethod, GenericRpcMethod, Id, RpcError, RpcRequest, RpcResponse};
|
||||||
|
|
||||||
|
use crate::SeedableContext;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
#[cfg(feature = "cbor")]
|
#[cfg(feature = "cbor")]
|
||||||
static ref CBOR_INTERNAL_ERROR: Vec<u8> =
|
static ref CBOR_INTERNAL_ERROR: Vec<u8> =
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
pub use crate as rpc_toolkit;
|
use std::fmt::Display;
|
||||||
use crate::{command, rpc_server, Context, SeedableContext};
|
use std::str::FromStr;
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use clap::Arg;
|
use clap::Arg;
|
||||||
use rpc_toolkit_macro::run_cli;
|
use rpc_toolkit_macro::run_cli;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::str::FromStr;
|
|
||||||
use std::{fmt::Display, sync::Arc};
|
|
||||||
use url::Host;
|
use url::Host;
|
||||||
use yajrc::RpcError;
|
use yajrc::RpcError;
|
||||||
|
|
||||||
|
pub use crate as rpc_toolkit;
|
||||||
|
use crate::{command, rpc_server, Context, SeedableContext};
|
||||||
|
|
||||||
pub struct AppState<T, U> {
|
pub struct AppState<T, U> {
|
||||||
seed: T,
|
seed: T,
|
||||||
data: U,
|
data: U,
|
||||||
@@ -93,9 +96,10 @@ fn dothething2<U: Serialize + for<'a> Deserialize<'a> + FromStr<Err = E>, E: Dis
|
|||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test() {
|
async fn test() {
|
||||||
use crate as rpc_toolkit;
|
|
||||||
use tokio::io::AsyncWriteExt;
|
use tokio::io::AsyncWriteExt;
|
||||||
|
|
||||||
|
use crate as rpc_toolkit;
|
||||||
|
|
||||||
let seed = Arc::new(ConfigSeed {
|
let seed = Arc::new(ConfigSeed {
|
||||||
host: Host::parse("localhost").unwrap(),
|
host: Host::parse("localhost").unwrap(),
|
||||||
port: 8000,
|
port: 8000,
|
||||||
|
|||||||
Reference in New Issue
Block a user