mirror of
https://github.com/adoyle0/leptos-use.git
synced 2025-01-23 09:09:21 -05:00
disabled webtransport for now
This commit is contained in:
parent
7fe153e525
commit
a677eaf877
3 changed files with 15 additions and 9 deletions
2
examples/use_webtransport/.cargo/config.toml
Normal file
2
examples/use_webtransport/.cargo/config.toml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[build]
|
||||||
|
rustflags = ["--cfg=web_sys_unstable_apis", "--cfg=has_std"]
|
|
@ -9,10 +9,10 @@ pub mod math;
|
||||||
pub mod storage;
|
pub mod storage;
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
|
||||||
#[cfg(web_sys_unstable_apis)]
|
// #[cfg(web_sys_unstable_apis)]
|
||||||
mod use_webtransport;
|
// mod use_webtransport;
|
||||||
#[cfg(web_sys_unstable_apis)]
|
// #[cfg(web_sys_unstable_apis)]
|
||||||
pub use use_webtransport::*;
|
// pub use use_webtransport::*;
|
||||||
|
|
||||||
mod is_err;
|
mod is_err;
|
||||||
mod is_none;
|
mod is_none;
|
||||||
|
|
|
@ -424,7 +424,6 @@ impl Default for UseWebTransportOptions {
|
||||||
pub enum StreamState {
|
pub enum StreamState {
|
||||||
Open,
|
Open,
|
||||||
Closed,
|
Closed,
|
||||||
ClosedWithError(WebTransportError),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait(?Send)]
|
#[async_trait(?Send)]
|
||||||
|
@ -600,9 +599,8 @@ macro_rules! impl_closable_stream {
|
||||||
|
|
||||||
async fn close_async(&self) -> Result<(), WebTransportError> {
|
async fn close_async(&self) -> Result<(), WebTransportError> {
|
||||||
let _ = JsFuture::from(self.writer.close()).await.map_err(|e| {
|
let _ = JsFuture::from(self.writer.close()).await.map_err(|e| {
|
||||||
let error = WebTransportError::FailedToCloseStream(e);
|
let error = WebTransportError::OnCloseWriter(e);
|
||||||
self.set_state
|
self.set_state.set(StreamState::Closed);
|
||||||
.set(StreamState::ClosedWithError(error.clone()));
|
|
||||||
error
|
error
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -749,13 +747,19 @@ fn create_bidir_stream(
|
||||||
/// Error enum for [`UseWebTransportOptions::on_error`]
|
/// Error enum for [`UseWebTransportOptions::on_error`]
|
||||||
#[derive(Debug, Clone, Error)]
|
#[derive(Debug, Clone, Error)]
|
||||||
pub enum WebTransportError {
|
pub enum WebTransportError {
|
||||||
/// The `WebTransport` is not connected yet. Call `open` first.
|
#[error("The `WebTransport` is not connected yet. Call `open` first.")]
|
||||||
NotConnected,
|
NotConnected,
|
||||||
|
#[error("Failed to open stream: {0:?}")]
|
||||||
FailedToOpenStream(JsValue),
|
FailedToOpenStream(JsValue),
|
||||||
|
#[error("Failed to open writer: {0:?}")]
|
||||||
FailedToOpenWriter(JsValue),
|
FailedToOpenWriter(JsValue),
|
||||||
|
#[error("Failed to open reader: {0:?}")]
|
||||||
FailedToOpenReader(JsValue),
|
FailedToOpenReader(JsValue),
|
||||||
|
#[error("Failed to read from stream: {0:?}")]
|
||||||
FailedToRead(JsValue),
|
FailedToRead(JsValue),
|
||||||
|
#[error("Failed to close writer: {0:?}")]
|
||||||
OnCloseWriter(JsValue),
|
OnCloseWriter(JsValue),
|
||||||
|
#[error("Failed to close reader: {0:?}")]
|
||||||
OnCloseReader(JsValue),
|
OnCloseReader(JsValue),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue