* fix: create document crash

* chore: fix ping

* chore: clippy
This commit is contained in:
Nathan.fooo 2024-02-02 09:33:48 +08:00 committed by GitHub
parent c1b797a2c4
commit 0875329a43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 3 deletions

View File

@ -153,6 +153,7 @@ impl WSClientHttpSender for Client {
} }
} }
// TODO(nathan): spawn for wasm
pub fn platform_spawn<T>(future: T) -> tokio::task::JoinHandle<T::Output> pub fn platform_spawn<T>(future: T) -> tokio::task::JoinHandle<T::Output>
where where
T: Future + Send + 'static, T: Future + Send + 'static,

View File

@ -40,12 +40,12 @@ impl Message {
/// Indicates whether a message is a ping message. /// Indicates whether a message is a ping message.
pub fn is_ping(&self) -> bool { pub fn is_ping(&self) -> bool {
false matches!(self, Message::Ping(_))
} }
/// Indicates whether a message is a pong message. /// Indicates whether a message is a pong message.
pub fn is_pong(&self) -> bool { pub fn is_pong(&self) -> bool {
false matches!(self, Message::Pong(_))
} }
/// Indicates whether a message ia s close message. /// Indicates whether a message ia s close message.

View File

@ -80,7 +80,9 @@ fn to_fut_message(msg: Result<Message>) -> FutMessage {
Message::Text(inner) => Ok(crate::Message::Text(inner)), Message::Text(inner) => Ok(crate::Message::Text(inner)),
Message::Binary(inner) => Ok(crate::Message::Binary(inner)), Message::Binary(inner) => Ok(crate::Message::Binary(inner)),
Message::Close(inner) => Ok(crate::Message::Close(inner.map(Into::into))), Message::Close(inner) => Ok(crate::Message::Close(inner.map(Into::into))),
Message::Ping(_) | Message::Pong(_) | Message::Frame(_) => return None, Message::Pong(inner) => Ok(crate::Message::Pong(inner)),
Message::Ping(inner) => Ok(crate::Message::Ping(inner)),
Message::Frame(_) => return None,
}, },
Err(err) => Err(crate::Error::from(err)), Err(err) => Err(crate::Error::from(err)),
}; };