mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-24 00:00:16 +02:00
Implement From<Bytes> for Message (#3273)
This commit is contained in:
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
# Unreleased
|
||||
|
||||
- **added:** Implement `From<Bytes>` for `Message` ([#3273])
|
||||
|
||||
[#3273]: https://github.com/tokio-rs/axum/pull/3273
|
||||
|
||||
# 0.8.2
|
||||
|
||||
- **added:** Implement `OptionalFromRequest` for `Json` ([#3142])
|
||||
|
||||
@@ -858,6 +858,12 @@ impl<'b> From<&'b [u8]> for Message {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Bytes> for Message {
|
||||
fn from(data: Bytes) -> Self {
|
||||
Message::Binary(data)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Vec<u8>> for Message {
|
||||
fn from(data: Vec<u8>) -> Self {
|
||||
Message::Binary(data.into())
|
||||
|
||||
Reference in New Issue
Block a user