Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: Drop AsyncTryReadWriteBytes and TryReadWriteBytes traits, revert to standard Read + Write, AsyncRead + AsyncWrite #195

Merged
merged 5 commits into from
Oct 23, 2024

Conversation

theangryangel
Copy link
Owner

@theangryangel theangryangel commented Oct 18, 2024

The purpose of this is to unlock something for #158. Without doing this we basically get stuck in a position where any new stream needs to be dealt with by the library.

Fundamentally I had a misunderstanding of the actual issue in #94.

Outcome of this:

  • Original Framed enum for tokio and blocking implementations are replaced with a what was FramedInner, however the inner stream is now boxed.
    • Sidebar why boxing? To make returning different implementations from a match statement or method easier for consumers of the library. There is a perf hit, but practically it's not relevant.
  • This allows for potentially any standard Read + Write stream for the blocking implementation. i.e. a file reader.
  • This allows for any AsyncRead + AsyncWrite stream for tokio implementation
  • Simplifies the consumption of the builder for end users
  • Removes any confusion and maintenance over the "inner" and outer frames by reducing the amount of code.
  • Removes the dependency on async_trait, therefore Remove async_trait macro in favor of AFIT & RPITIT #123 is no longer relevant

Additional extras bundled into this PR:

Migration for end users:

  • If you were matching on or generating the Framed type, you'll need to update what you're doing. Otherwise, probably nothing.

Outstanding work:

  • Make UdpStream safe (needs an internal inner buffer like the WebSocket implementation)
  • Remove the try_read_bytes temporary methods in both blocking and tokio implementations of Framed
  • Fix any relevant documentation
  • Break up blocking_impl/mod.rs like tokio_impl/mod.rs

@theangryangel theangryangel changed the title wip refactor!: Remove Framed, rename FramedInner to Framed, Box the inner stream Oct 18, 2024
@theangryangel theangryangel changed the title refactor!: Remove Framed, rename FramedInner to Framed, Box the inner stream refactor!: Drop AsyncTryReadWriteBytes and TryReadWriteBytes traits, revert to standard Read + Write, AsyncRead + AsyncWrite Oct 18, 2024
@theangryangel theangryangel merged commit 2a1ac10 into main Oct 23, 2024
5 checks passed
@theangryangel theangryangel deleted the feat-std-read-write-trait branch October 23, 2024 20:12
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.

feat: add convenience methods to builder to set ISI flags
1 participant