Skip to content

Commit

Permalink
Minimize deps even more
Browse files Browse the repository at this point in the history
  • Loading branch information
survived committed Nov 6, 2023
1 parent 2d0c802 commit e8c6565
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 14 deletions.
3 changes: 2 additions & 1 deletion Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"round-based",
"round-based-tests",
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.PHONY: docs docs-open

docs:
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --no-deps
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --no-deps --all-features

docs-test:
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly test --doc
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly test --doc --all-features

docs-open:
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --no-deps --open
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --no-deps --all-features --open
2 changes: 1 addition & 1 deletion round-based-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "round-based-derive"
version = "0.1.0"
version = "0.2.0"
edition = "2021"

[lib]
Expand Down
1 change: 1 addition & 0 deletions round-based-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "round-based-tests"
version = "0.1.0"
edition = "2021"
publish = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
3 changes: 2 additions & 1 deletion round-based/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ rustdoc-args = ["--cfg", "docsrs"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
futures = "0.3"
futures-util = { version = "0.3", default-features = false }
phantom-type = "0.3"
tracing = "0.1"
thiserror = "1"
Expand All @@ -29,6 +29,7 @@ tokio-stream = { version = "0.1", features = ["sync"], optional = true }
[dev-dependencies]
trybuild = "1"
matches = "0.1"
futures = "0.3"

[features]
default = []
Expand Down
6 changes: 3 additions & 3 deletions round-based/src/_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ use crate::{Delivery, Incoming, Outgoing};
pub fn fake_delivery<M>() -> impl Delivery<M> {
struct FakeDelivery<M>(PhantomType<M>);
impl<M> Delivery<M> for FakeDelivery<M> {
type Send = futures::sink::Drain<Outgoing<M>>;
type Receive = futures::stream::Pending<Result<Incoming<M>, Infallible>>;
type Send = futures_util::sink::Drain<Outgoing<M>>;
type Receive = futures_util::stream::Pending<Result<Incoming<M>, Infallible>>;

type SendError = Infallible;
type ReceiveError = Infallible;

fn split(self) -> (Self::Receive, Self::Send) {
(futures::stream::pending(), futures::sink::drain())
(futures_util::stream::pending(), futures_util::sink::drain())
}
}
FakeDelivery(PhantomType::new())
Expand Down
1 change: 1 addition & 0 deletions round-based/src/blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ impl SpawnBlocking for ExecuteInPlace {
pub use tokio_backend::SpawnOnTokio;

#[cfg(feature = "runtime-tokio")]
#[cfg_attr(docsrs, doc(cfg(feature = "dev")))]
mod tokio_backend {
use tokio::task::{JoinError, JoinHandle};

Expand Down
2 changes: 1 addition & 1 deletion round-based/src/delivery.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::error::Error;

use futures::{Sink, Stream};
use futures_util::{Sink, Stream};

/// Networking abstraction
///
Expand Down
12 changes: 10 additions & 2 deletions round-based/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,22 @@
//! Some protocols may require broadcast channel to be reliable. Simply saying, when party receives a
//! broadcast message over reliable channel it should be ensured that everybody else received the same
//! message.
//!
//! ## Features
//!
//! * `dev` enables development tools such as [protocol simulation](simulation)
//! * `runtime-tokio` tells that [computationally-heavy tasks](blocking) shall be executed using [tokio] runtime

#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(missing_docs)]
#![forbid(unused_crate_dependencies)]

// Fixes false-positive of `unused_crate_dependencies` lint
/// Fixes false-positive of `unused_crate_dependencies` lint that only occure in the tests
#[cfg(test)]
use trybuild as _;
mod false_positives {
use futures as _;
use trybuild as _;
}

pub mod blocking;
mod delivery;
Expand Down
2 changes: 1 addition & 1 deletion round-based/src/rounds_router/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ use std::collections::HashMap;
use std::fmt::Debug;
use std::mem;

use futures::{Stream, StreamExt};
use futures_util::{Stream, StreamExt};
use never::Never;
use phantom_type::PhantomType;
use thiserror::Error;
Expand Down
3 changes: 2 additions & 1 deletion round-based/src/simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@
use std::pin::Pin;
use std::sync::atomic::AtomicU64;
use std::sync::Arc;
use std::task::ready;
use std::task::{Context, Poll};

use futures::{ready, Sink, Stream};
use futures_util::{Sink, Stream};
use tokio::sync::broadcast;
use tokio_stream::wrappers::{errors::BroadcastStreamRecvError, BroadcastStream};

Expand Down

0 comments on commit e8c6565

Please sign in to comment.