Skip to content

Commit c6c4552

Browse files
committed
Remove once_cell and async-trait
1 parent 8529951 commit c6c4552

File tree

4 files changed

+10
-26
lines changed

4 files changed

+10
-26
lines changed

Cargo.lock

Lines changed: 0 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ edition = "2021"
2121
maintenance = { status = "experimental" }
2222

2323
[dependencies]
24-
async-trait = "0.1.80" # TODO: Still needed?
2524
byteorder = "1.5.0"
2625
futures = "0.3.31"
27-
once_cell = "1.21.3" # TODO: Still needed?
2826
pin-project = "1.1.10"
2927
snafu = "0.8.6"
3028
tokio = { version = "1.47.1", features = ["net", "rt", "time"] }

src/proto/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use async_trait::async_trait;
21
use std::error::Error;
32
use std::net::SocketAddr;
43
use tokio::io::{AsyncRead, AsyncWrite};
@@ -16,14 +15,14 @@ pub(crate) use self::request::Request;
1615
pub(crate) use self::response::Response;
1716
pub(crate) use self::watch::Watch;
1817

19-
#[async_trait]
2018
pub trait ZooKeeperTransport: AsyncRead + AsyncWrite + Sized + Send + 'static {
2119
type Addr: Send + Clone;
2220
type ConnectError: Error + Send + Sync + 'static;
23-
async fn connect(addr: Self::Addr) -> Result<Self, Self::ConnectError>;
21+
fn connect(
22+
addr: Self::Addr,
23+
) -> impl std::future::Future<Output = Result<Self, Self::ConnectError>> + std::marker::Send;
2424
}
2525

26-
#[async_trait]
2726
impl ZooKeeperTransport for tokio::net::TcpStream {
2827
type Addr = SocketAddr;
2928
type ConnectError = tokio::io::Error;

src/types/acl.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ use std::fmt;
22
use std::ops;
33

44
use std::string::ToString;
5-
6-
use once_cell::sync::Lazy;
5+
use std::sync::LazyLock;
76

87
/// Describes the ability of a user to perform a certain action.
98
///
@@ -189,11 +188,12 @@ impl Acl {
189188
}
190189
}
191190

192-
static ACL_CREATOR_ALL: Lazy<[Acl; 1]> = Lazy::new(|| [Acl::new(Permission::ALL, "auth", "")]);
193-
static ACL_OPEN_UNSAFE: Lazy<[Acl; 1]> =
194-
Lazy::new(|| [Acl::new(Permission::ALL, "world", "anyone")]);
195-
static ACL_READ_UNSAFE: Lazy<[Acl; 1]> =
196-
Lazy::new(|| [Acl::new(Permission::READ, "world", "anyone")]);
191+
static ACL_CREATOR_ALL: LazyLock<[Acl; 1]> =
192+
LazyLock::new(|| [Acl::new(Permission::ALL, "auth", "")]);
193+
static ACL_OPEN_UNSAFE: LazyLock<[Acl; 1]> =
194+
LazyLock::new(|| [Acl::new(Permission::ALL, "world", "anyone")]);
195+
static ACL_READ_UNSAFE: LazyLock<[Acl; 1]> =
196+
LazyLock::new(|| [Acl::new(Permission::READ, "world", "anyone")]);
197197

198198
impl fmt::Display for Acl {
199199
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

0 commit comments

Comments
 (0)