style: fmt the project (#54)

add rustfmt.toml

Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
This commit is contained in:
jokemanfire 2025-03-28 23:50:46 +08:00 • committed by GitHub
commit 0a2f13a1f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 158 additions and 132 deletions

View file

@ -4,9 +4,8 @@ use tokio::{
process::{ChildStdin, ChildStdout},
};
use crate::service::{RxJsonRpcMessage, ServiceRole, TxJsonRpcMessage};
use super::IntoTransport;
use crate::service::{RxJsonRpcMessage, ServiceRole, TxJsonRpcMessage};
pub(crate) fn child_process(
mut child: tokio::process::Child,

View file

@ -4,16 +4,14 @@ use std::marker::PhantomData;
use futures::{Sink, SinkExt, Stream, StreamExt};
use serde::{Serialize, de::DeserializeOwned};
use thiserror::Error;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio_util::{
bytes::{Buf, BufMut, BytesMut},
codec::{Decoder, Encoder, FramedRead, FramedWrite},
};
use crate::service::{RxJsonRpcMessage, ServiceRole, TxJsonRpcMessage};
use super::IntoTransport;
use crate::service::{RxJsonRpcMessage, ServiceRole, TxJsonRpcMessage};
#[cfg(feature = "transport-io")]
/// # StdIO Transport

View file

@ -1,13 +1,15 @@
//! reference: https://html.spec.whatwg.org/multipage/server-sent-events.html
use crate::model::{ClientJsonRpcMessage, ServerJsonRpcMessage};
use std::{collections::VecDeque, sync::Arc, time::Duration};
use futures::{FutureExt, Sink, Stream, StreamExt, future::BoxFuture, stream::BoxStream};
use reqwest::{
Client as HttpClient, IntoUrl, Url,
header::{ACCEPT, HeaderValue},
};
use sse_stream::{Error as SseError, Sse, SseStream};
use std::{collections::VecDeque, sync::Arc, time::Duration};
use thiserror::Error;
use crate::model::{ClientJsonRpcMessage, ServerJsonRpcMessage};
const MIME_TYPE: &str = "text/event-stream";
const HEADER_LAST_EVENT_ID: &str = "Last-Event-ID";

View file

@ -1,8 +1,5 @@
use crate::{
RoleServer, Service,
model::ClientJsonRpcMessage,
service::{RxJsonRpcMessage, TxJsonRpcMessage},
};
use std::{collections::HashMap, net::SocketAddr, sync::Arc};
use axum::{
Json, Router,
extract::{Query, State},
@ -14,13 +11,16 @@ use axum::{
routing::{get, post},
};
use futures::{Sink, SinkExt, Stream, StreamExt};
use std::{collections::HashMap, net::SocketAddr};
use tokio::io;
use tokio_stream::wrappers::ReceiverStream;
use tokio_util::sync::{CancellationToken, PollSender};
use tracing::Instrument;
use std::sync::Arc;
use tokio::io;
use crate::{
RoleServer, Service,
model::ClientJsonRpcMessage,
service::{RxJsonRpcMessage, TxJsonRpcMessage},
};
type SessionId = Arc<str>;
type TxStore =
Arc<tokio::sync::RwLock<HashMap<SessionId, tokio::sync::mpsc::Sender<ClientJsonRpcMessage>>>>;