Skip to content

Commit

Permalink
refactor: update and organize deps + features
Browse files Browse the repository at this point in the history
  • Loading branch information
ok-nick committed Aug 5, 2023
1 parent e1b3cb3 commit 5429b33
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 24 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

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

3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@

<img src="https://user-images.githubusercontent.com/25470747/258559272-32e79831-eda7-41b5-aba5-87c3d8fc363f.gif">

> **Warning**
> This library is still a work in progress. Do not expect full functionality.
## Examples
Below is a snippet of using the high-level API with [tokio](https://github.com/tokio-rs/tokio) for fetching live class information.
```rust
Expand Down
23 changes: 11 additions & 12 deletions ubs-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,24 @@ repository.workspace = true

[dependencies]
tl = "0.7.7"
hyper = { version = "0.14.27", features = ["client", "http1"] }
hyper = { version = "0.14.27", features = ["client"] }
cookie = "0.17.0"
futures = "0.3.28"
chrono = "0.4.26"
thiserror = "1.0.44"
regex = "1.9.1"
regex = "1.9.2"

# hyper-rustls = { version = "0.23.2", optional = true }
hyper-rustls = { version = "0.24.1" }
hyper-rustls = { version = "0.24.1", optional = true }

[dev-dependencies]
tokio = { version = "1.29.0", features = [
"rt",
"macros",
tokio = { version = "1.29.1", features = [
"rt",
"macros",
], default-features = false }

[features]
# Enables SIMD accelerated parsing for HTML (requires nightly)
# simd = ["tl/simd"]
# Enables easy HTTPS client creation
# TODO: remove http1 feature from hyper main dep
# client = ["hyper-rustls", "hyper/http1"]
default = ["rustls"]
# Enables SIMD accelerated parsing for HTML (requires nightly).
simd = ["tl/simd"]
# Enables high-level schedule iterators using rustls for TLS.
rustls = ["hyper-rustls"]
5 changes: 3 additions & 2 deletions ubs-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ use session::{Query, Session, SessionError, Token};

use futures::{TryStream, TryStreamExt};
use hyper::Client;
use hyper_rustls::HttpsConnectorBuilder;

/// Iterator over each page of the specified query.
///
/// If there is no course to career mapping for the specified course, this function
/// will return [`ScheduleError::FailedToInferCareer`](ScheduleError::FailedToInferCareer).
/// In that case, consider manually specifying the career via [`schedule_iter_with_career`](schedule_iter_with_career),
/// and sending a PR to add the inference.
#[cfg(feature = "rustls")]
pub async fn schedule_iter<'a>(
course: Course,
semester: Semester,
Expand All @@ -54,6 +54,7 @@ pub async fn schedule_iter<'a>(
/// Note that in some cases the career cannot be inferred from the course, thus it
/// is necessary to manually specify the career. Considering sending a PR with the
/// course to career mapping.
#[cfg(feature = "rustls")]
pub async fn schedule_iter_with_career<'a>(
course: Course,
semester: Semester,
Expand All @@ -63,7 +64,7 @@ pub async fn schedule_iter_with_career<'a>(
ScheduleError,
> {
let client = Client::builder().build(
HttpsConnectorBuilder::new()
hyper_rustls::HttpsConnectorBuilder::new()
.with_native_roots()
.https_only()
.enable_http1()
Expand Down
8 changes: 5 additions & 3 deletions ubs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ ubs-lib = { path = "../ubs-lib" } # TODO: temporary
chrono = { version = "0.4.26", features = ["serde"] }
futures = "0.3.28"
tokio = { version = "1.29.1", features = [
"rt",
"macros",
"rt",
"macros",
], default-features = false }
syntect = { version = "5.1.0", optional = true }
# miette = { version = "5.10.0", features = ["fancy"] }
syntect = {version = "5.0.0", optional = true}

[features]
default = ["color"]
# Enables syntax highlighting when `--pretty` is specified.
color = ["syntect"]

0 comments on commit 5429b33

Please sign in to comment.