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

recv_data should return concrete buf impl not generic #272

Open
taikulawo opened this issue Jan 9, 2025 · 1 comment
Open

recv_data should return concrete buf impl not generic #272

taikulawo opened this issue Jan 9, 2025 · 1 comment

Comments

@taikulawo
Copy link

similar like #93 but for recv_data.

Current h3 return Bytes but poll_data signature use impl Buf, it's hard for outside return owned concrete type without pay copy using Buf#bytes().

d is Bytes.

self.remaining_data -= d.remaining();

h2 crates return Bytes, not impl Buf, it's good.

pub async fn data(&mut self) -> Option<Result<Bytes, crate::Error>> {
      crate::poll_fn(move |cx| self.poll_data(cx)).await
  }

send_data should support generic over T, but should we also use generic on recv_data?

@taikulawo
Copy link
Author

Well, it's seems Bytes use shadow copy buf.map(|mut f| f.copy_to_bytes(f.remaining()))

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

No branches or pull requests

1 participant