Skip to content

Commit

Permalink
add api to convert axum Utf8Bytes to tungstenite Utf8Bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
getong committed Jan 13, 2025
1 parent e09cc59 commit e76ab32
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion axum/src/extract/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,15 @@ impl Utf8Bytes {
self.0.as_str()
}

fn into_tungstenite(self) -> ts::Utf8Bytes {
/// Convert Utf8Bytes into ts::Utf8Bytes
pub fn into_tungstenite(self) -> ts::Utf8Bytes {
self.0
}

/// Convert ts::Utf8Bytes into Utf8Bytes
pub fn from_tungstenite(byte: ts::Utf8Bytes) -> Self {
Utf8Bytes(ts::Utf8Bytes)
}
}

impl std::ops::Deref for Utf8Bytes {
Expand Down

0 comments on commit e76ab32

Please sign in to comment.