Skip to content

Commit 23bb346

Browse files
committed
--wip-- [skip ci]
1 parent 1591984 commit 23bb346

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"rust-analyzer.cargo.target": "wasm32-unknown-unknown",
44
"rust-analyzer.check.targets": ["wasm32-unknown-unknown"],
55
"rust-analyzer.check.command": "clippy",
6-
"rust-analyzer.cargo.features": "all"
6+
"rust-analyzer.cargo.features": "all",
7+
"rust-analyzer.cargo.targetDir": true
78
}

crates/xwt-web-sys/src/lib.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,3 +471,16 @@ impl Drop for Session {
471471
self.transport.close();
472472
}
473473
}
474+
475+
impl xwt_core::stream::AsErrorCode for Error {
476+
type ErrorCode = StreamErrorCode;
477+
478+
fn as_error_code(&self) -> Option<Self::ErrorCode> {
479+
let error: &WebTransportError = self.0.dyn_ref()?;
480+
if error.source() != WebTransportErrorSource::Stream {
481+
return None;
482+
}
483+
let code = error.stream_error_code().unwrap_or(0);
484+
Some(StreamErrorCode(code.into()))
485+
}
486+
}

0 commit comments

Comments
 (0)