File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4040 you likely need to re-enable the ` tokio ` feature ([ #1382 ] )
4141- ** breaking:** ` handler::{WithState, IntoService} ` are merged into one type,
4242 named ` HandlerService ` ([ #1418 ] )
43+ - ** added:** String and binary ` From ` impls have been added to ` extract::ws::Message `
44+ to be more inline with ` tungstenite ` ([ #1421 ] )
4345
4446[ #1368 ] : https://github.com/tokio-rs/axum/pull/1368
4547[ #1371 ] : https://github.com/tokio-rs/axum/pull/1371
@@ -52,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5254[ #1408 ] : https://github.com/tokio-rs/axum/pull/1408
5355[ #1414 ] : https://github.com/tokio-rs/axum/pull/1414
5456[ #1418 ] : https://github.com/tokio-rs/axum/pull/1418
57+ [ #1421 ] : https://github.com/tokio-rs/axum/pull/1421
5558
5659# 0.6.0-rc.2 (10. September, 2022)
5760
Original file line number Diff line number Diff line change @@ -545,6 +545,30 @@ impl Message {
545545 }
546546}
547547
548+ impl From < String > for Message {
549+ fn from ( string : String ) -> Self {
550+ Message :: Text ( string)
551+ }
552+ }
553+
554+ impl < ' s > From < & ' s str > for Message {
555+ fn from ( string : & ' s str ) -> Self {
556+ Message :: Text ( string. into ( ) )
557+ }
558+ }
559+
560+ impl < ' b > From < & ' b [ u8 ] > for Message {
561+ fn from ( data : & ' b [ u8 ] ) -> Self {
562+ Message :: Binary ( data. into ( ) )
563+ }
564+ }
565+
566+ impl From < Vec < u8 > > for Message {
567+ fn from ( data : Vec < u8 > ) -> Self {
568+ Message :: Binary ( data)
569+ }
570+ }
571+
548572impl From < Message > for Vec < u8 > {
549573 fn from ( msg : Message ) -> Self {
550574 msg. into_data ( )
You can’t perform that action at this time.
0 commit comments