Skip to content

feat: add async APIs for ToonEncoder and ToonDecoder#19

Merged
239573049 merged 1 commit intotoon-format:mainfrom
parsapanahpoor:feature/async-api
Dec 16, 2025
Merged

feat: add async APIs for ToonEncoder and ToonDecoder#19
239573049 merged 1 commit intotoon-format:mainfrom
parsapanahpoor:feature/async-api

Conversation

@parsapanahpoor
Copy link
Contributor

Summary

Adds asynchronous API support to the TOON library, enabling non-blocking encoding and decoding operations.

Changes

ToonEncoder

  • EncodeAsync<T>() - Async encoding with default/custom options
  • EncodeToBytesAsync<T>() - Async encoding to UTF-8 bytes
  • EncodeToStreamAsync<T>() - Async encoding directly to stream

ToonDecoder

  • DecodeAsync() / DecodeAsync<T>() - Async decoding from string
  • DecodeAsync(stream) / DecodeAsync<T>(stream) - Async decoding from stream

All methods support CancellationToken for cancellation.

Why?

  • Modern .NET applications rely heavily on async/await patterns
  • Stream-based operations benefit from true async I/O
  • Follows .NET library design guidelines

Testing

Added 15 new tests in ToonAsyncTests.cs covering:

  • Basic encode/decode operations
  • Stream operations
  • Cancellation token support
  • Round-trip verification
  • Error handling

Checklist

  • Code follows project conventions
  • XML documentation added
  • Unit tests added and passing
  • No breaking changes

@parsapanahpoor parsapanahpoor requested a review from a team as a code owner December 6, 2025 23:38
@parsapanahpoor
Copy link
Contributor Author

Hi maintainers! 👋

This is my first contribution to this project. I've added async API support for both ToonEncoder and ToonDecoder.

Key additions:

  • EncodeAsync<T>() and variants
  • DecodeAsync() and DecodeAsync<T>() with stream support
  • Full CancellationToken support
  • 15 new unit tests (all passing)

I'd appreciate any feedback or review when you have time. Thanks! 🙏

Copy link
Contributor

@239573049 239573049 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve

@239573049 239573049 merged commit f7b338c into toon-format:main Dec 16, 2025
0 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants