disabled webtransport for now

This commit is contained in:
Maccesch 2024-01-30 00:02:14 +00:00
parent 7fe153e525
commit a677eaf877
3 changed files with 15 additions and 9 deletions

View file

@ -0,0 +1,2 @@
[build]
rustflags = ["--cfg=web_sys_unstable_apis", "--cfg=has_std"]

View file

@ -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;

View file

@ -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),
} }