Skip to content

Commit

Permalink
Add use_dependencies feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
tyleragreen committed Sep 15, 2023
1 parent 5d1484c commit b70193d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions example-app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ serde_json = "1.0.103"
tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] }
tower = "0.4.13"
ureq = "2.7.1"
mime = { version = "0.3.17", optional = true }

[build-dependencies]
prost-build = "0.12"

[dev-dependencies]
mockito = "1.1.0"

[features]
use_dependencies = ["mime"]
4 changes: 4 additions & 0 deletions example-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ axum::Server::bind(&address)
cargo test
cargo run
```
These commands include a few (and hopefully growing number of) re-implemented library crates. I challenged myself to maintain the same interface and learn how these libraries work. To run with the original dependencies, this works.
```
cargo test --features "use_dependencies"
```

## Sample Feed
```
Expand Down
2 changes: 2 additions & 0 deletions example-app/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ async fn list_handler(state: State<AppState>) -> impl IntoResponse {

#[cfg(test)]
mod api_tests {
#[cfg(not(feature = "use_dependencies"))]
use crate::deps::mime;

use crate::fetcher::Feed;
use crate::scheduler_interface::{SchedulerInterface, TaskSender};
use tulsa::AsyncTask;
Expand Down

0 comments on commit b70193d

Please sign in to comment.