adamreichold opened a new pull request, #10571: URL: https://github.com/apache/arrow-rs/pull/10571
The AsRef impl was limited to references to Buffer instead of Buffer itself which is unnecessary since the signature of as_ref already provides the necessary indirection and it also is not the implementation required for wider ecosystem integration. # Which issue does this PR close? - Closes #10570. # Rationale for this change I am trying to use the newly available `StreamEncoder` from the `arrow_ipc` crate together with `Body::from_stream` from `axum`, but calling `bytes::Bytes::from_owner` fails due to an unsatisfied trait bound which I have to work around by local newtype wrapping. # What changes are included in this PR? A fix for the overly restrictive `AsRef` impl and also writing `Bytes::from_owner` through as generic and canonical way to wrap a given `Buffer` as a `bytes::Bytes` object (so it can be used with `Body::from_stream` directly. # Are these changes tested? The more general impl is covered by the same tests as the existing one and the new `From` impl is exercised by the doctest. # Are there any user-facing changes? This is strictly speaking a breaking change via downstream trait coherence, but I would argue that the existing `AsRef` is erroneously restricted and would therefore classify this as a typing bug fix. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
