diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md index 9749052f..ad23b447 100644 --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -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` for `Message` ([#3273]) + +[#3273]: https://github.com/tokio-rs/axum/pull/3273 + # 0.8.2 - **added:** Implement `OptionalFromRequest` for `Json` ([#3142]) diff --git a/axum/src/extract/ws.rs b/axum/src/extract/ws.rs index 08dbe204..2f367e43 100644 --- a/axum/src/extract/ws.rs +++ b/axum/src/extract/ws.rs @@ -858,6 +858,12 @@ impl<'b> From<&'b [u8]> for Message { } } +impl From for Message { + fn from(data: Bytes) -> Self { + Message::Binary(data) + } +} + impl From> for Message { fn from(data: Vec) -> Self { Message::Binary(data.into())