Skip to content

Commit

Permalink
Merge pull request #138 from nttcom/LSP/WASM
Browse files Browse the repository at this point in the history
Enable rust-analyzer for cfg
  • Loading branch information
yuki-uchida authored Dec 12, 2024
2 parents d69adb6 + 2234dca commit df9b692
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 22 deletions.
8 changes: 4 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"editor.defaultFormatter": "rust-lang.rust-analyzer",
"editor.inlayHints.enabled": "on"
},
"rust-analyzer.cargo.cfgs": {
"web_sys_unstable_apis": ""
},
"rust-analyzer.checkOnSave": true,
"rust-analyzer.check.command": "clippy"
"rust-analyzer.check.command": "clippy",
"rust-analyzer.cargo.extraEnv": {
"RUSTFLAGS": "--cfg web_sys_unstable_apis"
}
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Both server and browser client are written in Rust.

> [!NOTE]
> draft-ietf-moq-transport-06 prototype is [here](https://github.com/nttcom/moq-wasm/tree/draft-06)
## Implementation

Supported version: draft-ietf-moq-transport-06
Expand Down Expand Up @@ -38,6 +41,7 @@ Supported version: draft-ietf-moq-transport-06
- [ ] Priorities
- [ ] Object Cache


## Modules

### moqt-core
Expand Down
2 changes: 1 addition & 1 deletion moqt-client-sample/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ features = [
]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(web_sys_unstable_apis)'] }
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(web_sys_unstable_apis)'] }
2 changes: 0 additions & 2 deletions moqt-client-sample/config.toml

This file was deleted.

17 changes: 2 additions & 15 deletions moqt-client-sample/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,22 +671,9 @@ impl MOQTClient {
}

#[wasm_bindgen(js_name = sendUnsubscribeMessage)]
pub async fn send_unsubscribe_message(
&self,
track_namespace: js_sys::Array,
track_name: String,
) -> Result<JsValue, JsValue> {
pub async fn send_unsubscribe_message(&self, subscribe_id: u64) -> Result<JsValue, JsValue> {
if let Some(writer) = &*self.control_stream_writer.borrow() {
let length = track_namespace.length();
let mut track_namespace_vec: Vec<String> = Vec::with_capacity(length as usize);
for i in 0..length {
let js_element = track_namespace.get(i);
let string_element = js_element
.as_string()
.ok_or_else(|| JsValue::from_str("Array contains a non-string element"))?;
track_namespace_vec.push(string_element);
}
let unsubscribe_message = Unsubscribe::new(track_namespace_vec, track_name);
let unsubscribe_message = Unsubscribe::new(subscribe_id);
let mut unsubscribe_message_buf = BytesMut::new();
unsubscribe_message.packetize(&mut unsubscribe_message_buf);

Expand Down

0 comments on commit df9b692

Please sign in to comment.