Skip to content

Commit

Permalink
Optimize deps
Browse files Browse the repository at this point in the history
  • Loading branch information
bubelov committed Oct 19, 2024
1 parent e0aace1 commit 073b42f
Show file tree
Hide file tree
Showing 15 changed files with 139 additions and 156 deletions.
15 changes: 0 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 24 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,64 @@ panic = "abort"

[dependencies]

# This is the main dependency, providing a webserver and core infra
# https://github.com/actix/actix-web/blob/master/actix-web/CHANGES.md
actix-web = { version = "4.9.0", default-features = false, features = ["macros", "compress-brotli"] }

# JSON RPC support
# https://crates.io/crates/jsonrpc-v2
jsonrpc-v2 = { version = "0.13.0", default-features = false, features = ["actix-web-v4-integration", "easy-errors"] }

# Rate limiters
# https://github.com/AaronErhardt/actix-governor/releases
actix-governor = { version = "0.6.0", default-features = false }

# We're using SQLite because it's portable and it requires no maintenance
# SQLite is fast enough for our needs and we aren't aiming for infinite scalability
# https://github.com/rusqlite/rusqlite/releases
rusqlite = { version = "0.31.0", default-features = false, features = ["bundled", "time", "serde_json"] }

# That's an industry standard for making HTTP requests
# https://github.com/seanmonstar/reqwest/releases
reqwest = { version = "0.12.8", default-features = false, features = ["rustls-tls", "json"] }

# Used for mapping Rust structs to JSON via derive annotation
# https://github.com/serde-rs/serde/releases
serde = { version = "1.0.210", default-features = false, features = ["derive"] }

# JSON is heavily used in this project
# https://github.com/serde-rs/json/releases
serde_json = { version = "1.0.128", default-features = false }

# That's an industry starnard for working with time
# TODO consider switching to std alternatives, if/when present
# https://github.com/time-rs/time/releases
time = { version = "0.3.36", default-features = false, features = ["macros", "serde-well-known"] }

# Async logging infra
# https://github.com/tokio-rs/tracing/releases
tracing = { version = "0.1.40", default-features = false }

# Async logging infra
# https://github.com/tokio-rs/tracing/releases
tracing-subscriber = { version = "0.3.18", default-features = false, features = ["json", "env-filter", "fmt"] }

# Used to embed database migrations
# https://github.com/Michael-F-Bryan/include_dir/tags
include_dir = { version = "0.7.4", default-features = false }

# https://github.com/tokio-rs/tokio/releases
tokio = { version = "1.40.0", default-features = false, features = ["macros"] }

# Used for dealing with area bounds
# https://github.com/georust/geojson/tags
geojson = { version = "0.24.1", default-features = false, features = ["geo-types"] }

# Used for dealing with area bounds
# https://github.com/georust/geo/blob/main/geo/CHANGES.md
geo = { version = "0.28.0", default-features = false }

# https://github.com/rust-lang/futures-rs/releases
futures-util = { version = "0.3.31", default-features = false }

# https://github.com/hyperium/http/releases
http = { version = "1.1.0", default-features = false }

# We're wrapping blocking SQLite connections into an async pool
# https://github.com/bikeshedder/deadpool/blob/master/sqlite/CHANGELOG.md
deadpool-sqlite = { version = "0.8.1", default-features = false, features = ["rt_tokio_1"] }

# https://github.com/AaronErhardt/actix-governor/releases
actix-governor = { version = "0.6.0", default-features = false }

# https://crates.io/crates/jsonrpc-v2
jsonrpc-v2 = { version = "0.13.0", default-features = false, features = ["actix-web-v4-integration", "easy-errors"] }

# Used to handle area icons
# https://crates.io/crates/base64
base64 = "0.22.1"
base64 = { version = "0.22.1", default-features = false }
2 changes: 1 addition & 1 deletion src/area/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,10 @@ mod test {
test::{mock_conn, mock_state, mock_tags},
Result,
};
use actix_web::test;
use geojson::{Feature, GeoJson};
use serde_json::{json, Map};
use time::{macros::datetime, OffsetDateTime};
use tokio::test;

#[test]
async fn insert() -> Result<()> {
Expand Down
2 changes: 1 addition & 1 deletion src/area/v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ mod test {
use crate::error::{self, ApiError};
use crate::test::mock_state;
use crate::Result;
use actix_web::http::StatusCode;
use actix_web::test::TestRequest;
use actix_web::web::{scope, Data, QueryConfig};
use actix_web::{test, App};
use geojson::{Feature, GeoJson};
use http::StatusCode;
use serde_json::Map;
use time::macros::datetime;

Expand Down
2 changes: 0 additions & 2 deletions src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ fn get_migrations() -> Result<Vec<Migration>> {
Ok(res)
}

use std::path::PathBuf;

#[cfg(test)]
pub mod test {
use rusqlite::Connection;
Expand Down
2 changes: 1 addition & 1 deletion src/element/v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ mod test {
use crate::osm::overpass::OverpassElement;
use crate::test::mock_state;
use crate::Result;
use actix_web::http::StatusCode;
use actix_web::test::TestRequest;
use actix_web::web::{scope, Data, QueryConfig};
use actix_web::{test, App};
use http::StatusCode;
use time::macros::datetime;

#[test]
Expand Down
8 changes: 0 additions & 8 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use std::fmt::{Display, Formatter};
pub enum Error {
IO(std::io::Error),
Rusqlite(rusqlite::Error),
Http(http::Error),
Reqwest(reqwest::Error),
SerdeJson(serde_json::Error),
TimeFormat(time::error::Format),
Expand All @@ -32,7 +31,6 @@ impl Display for Error {
match self {
Error::IO(err) => err.fmt(f),
Error::Rusqlite(err) => err.fmt(f),
Error::Http(err) => err.fmt(f),
Error::Reqwest(err) => err.fmt(f),
Error::SerdeJson(err) => err.fmt(f),
Error::TimeFormat(err) => err.fmt(f),
Expand Down Expand Up @@ -83,12 +81,6 @@ impl From<rusqlite::Error> for Error {
}
}

impl From<http::Error> for Error {
fn from(error: http::Error) -> Self {
Error::Http(error)
}
}

impl From<reqwest::Error> for Error {
fn from(error: reqwest::Error) -> Self {
Error::Reqwest(error)
Expand Down
Loading

0 comments on commit 073b42f

Please sign in to comment.