Skip to content

Commit cc8bc6b

Browse files
authored
Merge pull request rust-bitcoin#104 from nyonson/rename-feature
Rename "async" feature to "futures"
2 parents 221fd6d + 7e10bd7 commit cc8bc6b

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

protocol/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rust-version = "1.63.0"
1111
[features]
1212
default = ["std"]
1313
# High-level wrappers using futures traits.
14-
async = ["std", "dep:futures"]
14+
futures = ["std", "dep:futures"]
1515
# High-level wrappers using tokio traits - may affect MSRV requirements.
1616
tokio = ["std", "dep:tokio"]
1717
std = ["alloc", "bitcoin/std", "bitcoin_hashes/std", "chacha20-poly1305/std", "rand/std", "rand/std_rng"]

protocol/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ A BIP324 library to establish and communicate over an encrypted channel.
44

55
The library is designed with a bare `no_std` and "Sans I/O" interface to keep it as agnostic as possible to application runtimes, but higher level interfaces are exposed for ease of use.
66

7-
The `async` feature includes the high-level `AsyncProcotol` type which helps create and manage an encrypted channel.
7+
The `futures` feature includes the high-level `AsyncProcotol` type which helps create and manage an encrypted channel.
88

99
The lower-level `Handshake` and `PacketHandler` types can be directly used by applications which require more control. The handshake performs the one-and-a-half round trip dance between the peers in order to generate secret materials. A successful handshake results in a packet handler which performs the encrypt and decrypt operations for the lifetime of the channel.
1010

1111
## Feature Flags
1212

1313
* `alloc` -- Expose memory allocation dependent features.
1414
* `std` -- Includes the `alloc` memory allocation feature as well as extra standard library dependencies for I/O and random number generators.
15-
* `async` -- High level wrappers for asynchronous read and write runtimes using agnostic futures-rs traits.
16-
* `tokio` -- Same wrappers as `async`, but using the popular tokio runtime's specific traits instead of futures-rs.
15+
* `futures` -- High level wrappers for asynchronous read and write runtimes using agnostic futures-rs traits.
16+
* `tokio` -- Same wrappers as `futures`, but using the popular tokio runtime's specific traits instead of futures-rs.
1717

1818
## Minimum Supported Rust Version (MSRV)
1919

protocol/src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use bitcoin_hashes::{hkdf, sha256};
4545
use fschacha20poly1305::{FSChaCha20, FSChaCha20Poly1305};
4646
// Default to the futures-rs traits, but can overwrite with more specific
4747
// tokio implemenations for easier caller integration.
48-
#[cfg(all(feature = "async", not(feature = "tokio")))]
48+
#[cfg(all(feature = "futures", not(feature = "tokio")))]
4949
use futures::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
5050
#[cfg(feature = "tokio")]
5151
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
@@ -1065,13 +1065,13 @@ impl fmt::Display for ProtocolError {
10651065
}
10661066

10671067
/// A protocol session with handshake and send/receive packet management.
1068-
#[cfg(any(feature = "async", feature = "tokio"))]
1068+
#[cfg(any(feature = "futures", feature = "tokio"))]
10691069
pub struct AsyncProtocol {
10701070
reader: AsyncProtocolReader,
10711071
writer: AsyncProtocolWriter,
10721072
}
10731073

1074-
#[cfg(any(feature = "async", feature = "tokio"))]
1074+
#[cfg(any(feature = "futures", feature = "tokio"))]
10751075
impl AsyncProtocol {
10761076
/// New protocol session which completes the initial handshake and returns a handler.
10771077
///
@@ -1206,7 +1206,7 @@ impl AsyncProtocol {
12061206
}
12071207

12081208
/// State machine of an asynchronous packet read.
1209-
#[cfg(any(feature = "async", feature = "tokio"))]
1209+
#[cfg(any(feature = "futures", feature = "tokio"))]
12101210
#[derive(Debug)]
12111211
enum DecryptState {
12121212
ReadingLength {
@@ -1219,7 +1219,7 @@ enum DecryptState {
12191219
},
12201220
}
12211221

1222-
#[cfg(any(feature = "async", feature = "tokio"))]
1222+
#[cfg(any(feature = "futures", feature = "tokio"))]
12231223
impl Default for DecryptState {
12241224
fn default() -> Self {
12251225
DecryptState::ReadingLength {
@@ -1230,13 +1230,13 @@ impl Default for DecryptState {
12301230
}
12311231

12321232
/// Manages an async buffer to automatically decrypt contents of received packets.
1233-
#[cfg(any(feature = "async", feature = "tokio"))]
1233+
#[cfg(any(feature = "futures", feature = "tokio"))]
12341234
pub struct AsyncProtocolReader {
12351235
packet_reader: PacketReader,
12361236
state: DecryptState,
12371237
}
12381238

1239-
#[cfg(any(feature = "async", feature = "tokio"))]
1239+
#[cfg(any(feature = "futures", feature = "tokio"))]
12401240
impl AsyncProtocolReader {
12411241
/// Decrypt contents of received packet from buffer.
12421242
///
@@ -1296,12 +1296,12 @@ impl AsyncProtocolReader {
12961296
}
12971297

12981298
/// Manages an async buffer to automatically encrypt and send contents in packets.
1299-
#[cfg(any(feature = "async", feature = "tokio"))]
1299+
#[cfg(any(feature = "futures", feature = "tokio"))]
13001300
pub struct AsyncProtocolWriter {
13011301
packet_writer: PacketWriter,
13021302
}
13031303

1304-
#[cfg(any(feature = "async", feature = "tokio"))]
1304+
#[cfg(any(feature = "futures", feature = "tokio"))]
13051305
impl AsyncProtocolWriter {
13061306
/// Encrypt contents and write packet buffer.
13071307
///

0 commit comments

Comments
 (0)