Skip to content

Commit 8c661e9

Browse files
committed
Document Tokio migration companion
1 parent 290ba80 commit 8c661e9

2 files changed

Lines changed: 36 additions & 3 deletions

File tree

docs/MIGRATION.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,40 @@ expose `is_failed()` and fail closed after malformed Base64 input; unchecked
213213
`into_inner()` remains available for explicit recovery of the wrapped object
214214
after a decode error.
215215

216-
The `tokio` feature is reserved for future async wrappers. It is currently
217-
inert and dependency-free; use the explicit `stream` feature for `std::io`
218-
wrappers.
216+
The core crate's `tokio` feature is reserved, inert, and dependency-free. For
217+
Tokio applications, use the optional `base64-ng-tokio` companion crate instead:
218+
219+
```toml
220+
[dependencies]
221+
base64-ng = "1.3.3"
222+
base64-ng-tokio = "1.3.3"
223+
tokio = { version = "1.52.3", features = ["io-util"] }
224+
```
225+
226+
```rust
227+
use base64_ng::STANDARD;
228+
use base64_ng_tokio::{encode_reader_to_writer_limited, EncoderReader, EncoderWriter};
229+
use tokio::io::{AsyncReadExt, AsyncWriteExt};
230+
231+
# async fn example() -> std::io::Result<()> {
232+
let mut input = &b"hello"[..];
233+
let mut output = Vec::new();
234+
encode_reader_to_writer_limited(&STANDARD, &mut input, &mut output, 1024).await?;
235+
assert_eq!(output, b"aGVsbG8=");
236+
237+
let mut reader = EncoderReader::new(&b"hello"[..], STANDARD);
238+
let mut streamed = Vec::new();
239+
reader.read_to_end(&mut streamed).await?;
240+
assert_eq!(streamed, b"aGVsbG8=");
241+
242+
let mut writer = EncoderWriter::new(Vec::new(), STANDARD);
243+
writer.write_all(b"hello").await?;
244+
writer.shutdown().await?;
245+
let encoded = writer.into_inner()?;
246+
assert_eq!(encoded, b"aGVsbG8=");
247+
# Ok(())
248+
# }
249+
```
219250

220251
## Security Notes
221252

release-notes/RELEASE_NOTES_1.3.3.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ wasm `simd128` runtime-dispatch profile with explicit runtime smoke evidence.
4444
- Aligned roadmap and README wording with the current async split: the core
4545
`tokio` feature remains inert, while `base64-ng-tokio` is the admitted
4646
async helper and streaming adapter surface.
47+
- Updated the migration guide with the same async split and a
48+
`base64-ng-tokio` migration example.
4749
- Added release-gated wasm SIMD codegen evidence through
4850
`scripts/generate_wasm_simd_evidence.sh`, which emits test-harness LLVM IR
4951
with `target-feature=+simd128` when the wasm target is installed.

0 commit comments

Comments
 (0)