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

Don't require an Encoder type while constructing FramedWrite so we can be generic over the lifetime #462

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

w4
Copy link

@w4 w4 commented Feb 1, 2021

PR Type

Feature/Bug Fix

PR Checklist

Check your PR fulfills the following:

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • Format code with the latest stable rustfmt

Overview

This is a breaking change as it changes the signature of FramedWrite. This punts the responsibility of grabbing the type of item to write() rather than upon construction, essentially allowing us to treat the item as:

impl FramedWrite {
    fn write<'a>(&mut self, item: Item<'a>);
}

rather than the current:

impl<'a> FramedWrite<'a> {
    fn write(&mut self, item: Item<'a>);
}

The new signature of FramedWrite is now:

FramedWrite<WriteHalf<TcpStream>, MyEncoder, <MyEncoder as Encoder<MyType>>::Error>

rather than:

FramedWrite<MyType, WriteHalf<TcpStream>, MyEncoder>

@w4 w4 force-pushed the master branch 3 times, most recently from 6c04d4e to 8799836 Compare February 1, 2021 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants