| Crates.io | anysc-rustls |
| lib.rs | anysc-rustls |
| version | 0.1.1 |
| created_at | 2025-08-13 21:38:33.043633+00 |
| updated_at | 2025-09-12 09:33:32.905759+00 |
| description | crate-level shim layer for any {async crate}-rustls |
| homepage | https://crates.io/crates/anysc-rustls |
| repository | https://github.com/ohkami-rs/anysc-rustls |
| max_upload_size | |
| id | 1794163 |
| size | 30,697 |
anysc-rustlscrate-level shim layer for any {async crate}-rustls
See the next section for details.
Add to dependencies:
[dependencies]
# ...
anysc-rustls = { version = "0.1", optional = true }
Activate one of io_* feature flags:
Depending on the use case, enable some inheritied features:
aws-lc-rsaws_lc_rsearly-datafipsloggingringtls12Write your code with anysc-rustls as with {tokio, futures}-rustls.
Just reexporting all the items of one of
based on the io_* feature flag selected.
The point is that this is a crate: it enables, for some (maybe niche) crates that
tokio::io, futures::io)tls), to switch {async crate}-rustls dependencies without any needless dependencies.
That's impossible by other way: if simply having a submodule reexporting
tokio-rustls and futures-rustls conditionally with respective feature flags (like tokio-io, futures-io),
indeed it works, but the crate's [dependencies] will be like
[dependencies]
tokio-rustls = { optional = true, version = ... }
futures-rustls = { optional = true, version = ... }
[features]
tokio-io = ...
futures-io = ...
tls = ...
Here, how we setup the features?
tokio-io = if "tls" ["dep:tokio-rustls"] + futures-io = if "tls" ["dep:futures-tls"]
impossible.
tls = if "tokio-io" ["dep:tokio-rustls"] else if "futures-io" ["dep:futures-tls"]
impossible.
tls = ["dep:tokio-rustls", "dep:futures-rustls"]
works, but one of them must be needless.
So it's impossible to avoid undesired dependencies in this way.
However, it's enabled by a crate-level shim layer as this crate:
[dependencies]
anysc-rustls = { version = "0.1", optional = true }
[features]
tls = ["dep:anysc-rustls"]
tokio-io = ["anysc-rustls?/io_tokio", ...]
futures-io = ["anysc-rustls?/io_futures", ...]
Yes, that's done by the <crate>?/<feature> syntax!