Skip to content

Commit b6b4a81

Browse files
committed
Remove unneeded features from client crate
1 parent dbb4ea3 commit b6b4a81

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

replicant-core/Cargo.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name = "replicant-core"
33
version = "0.1.1"
44
edition = "2021"
55

6+
[features]
7+
default = []
8+
server = ["sqlx/postgres", "axum", "argon2"]
9+
610
[dependencies]
711
serde = { workspace = true }
812
serde_json = { workspace = true }
@@ -12,8 +16,8 @@ thiserror = { workspace = true }
1216
json-patch = "1.2"
1317
sha2 = "0.10"
1418
strum = { version = "0.26", features = ["derive"] }
15-
sqlx = { version = "0.8", features = ["runtime-tokio", "postgres", "json", "uuid", "chrono", "migrate"] }
16-
argon2 = "0.5"
17-
axum = { version = "0.7", features = ["ws"] }
19+
sqlx = { version = "0.8", features = ["runtime-tokio", "json", "uuid", "chrono", "migrate"] }
20+
argon2 = { version = "0.5", optional = true }
21+
axum = { version = "0.7", features = ["ws"], optional = true }
1822
tracing = { workspace = true }
1923
tokio = { workspace = true }

replicant-core/src/errors.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
use crate::protocol;
2+
#[cfg(feature = "server")]
23
use axum::http::StatusCode;
4+
#[cfg(feature = "server")]
35
use axum::response::{IntoResponse, Response};
46
use chrono::ParseError;
57
use std::fmt::{Display, Formatter};
68
use thiserror::Error;
79
use tokio::sync::mpsc::error::SendError;
10+
#[cfg(feature = "server")]
811
use tracing::log::warn;
912
#[derive(Error, Debug)]
1013
#[non_exhaustive]
@@ -61,6 +64,7 @@ pub enum ServerError {
6164
#[error("{0}")]
6265
ApiError(#[from] ApiError),
6366

67+
#[cfg(feature = "server")]
6468
#[error("argon2 Library Error: {0}")]
6569
HashingError(argon2::password_hash::Error),
6670

@@ -99,6 +103,7 @@ pub enum ClientError {
99103
ChannelClosed,
100104
}
101105

106+
#[cfg(feature = "server")]
102107
impl From<argon2::password_hash::Error> for SyncError {
103108
fn from(error: argon2::password_hash::Error) -> Self {
104109
SyncError::Server(ServerError::HashingError(error))
@@ -178,6 +183,7 @@ impl Display for ApiError {
178183
}
179184
}
180185
}
186+
#[cfg(feature = "server")]
181187
impl IntoResponse for SyncError {
182188
fn into_response(self) -> Response {
183189
#[derive(serde::Serialize)]

replicant-server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ name = "replicant-server"
1212
path = "src/main.rs"
1313

1414
[dependencies]
15-
replicant-core = { path = "../replicant-core" }
15+
replicant-core = { path = "../replicant-core", features = ["server"] }
1616
tokio = { workspace = true }
1717
tokio-tungstenite = { version = "0.21", features = ["rustls-tls-webpki-roots"] }
1818
axum = { version = "0.7", features = ["ws"] }

0 commit comments

Comments
 (0)