mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
* 0.20 Changelog * Improve changelog generator * Add blog post * Add blog post * Apply suggestions from code review Co-authored-by: WorldSEnder <WorldSEnder@users.noreply.github.com> Co-authored-by: Julius Lungys <32368314+voidpumpkin@users.noreply.github.com> * update Changelog * update Cargo.toml * changelog gen compiles * website version 0.20 * add migration guides * prettier * i18n Co-authored-by: WorldSEnder <WorldSEnder@users.noreply.github.com> Co-authored-by: Julius Lungys <32368314+voidpumpkin@users.noreply.github.com>
59 lines
2.8 KiB
Plaintext
59 lines
2.8 KiB
Plaintext
---
|
|
title: Debugging
|
|
---
|
|
|
|
# デバッグ
|
|
|
|
## パニック
|
|
|
|
Rust シンボルで良いスタックトレースをするには
|
|
[`console_error_panic`](https://github.com/rustwasm/console_error_panic_hook)クレートを使用してください。
|
|
注意として、`cargo-web`でビルドされたものとは互換性がありません。
|
|
|
|
## コンソールでのログ
|
|
|
|
一般的に、Wasm の Web アプリはブラウザの API と連携することができ、`console.log`の API も例外ではありません。
|
|
いつくかの選択肢があります:
|
|
|
|
### [`wasm-logger`](https://crates.io/crates/wasm-logger)
|
|
|
|
このクレートは Rust の`log`クレートと親和性があります。
|
|
|
|
```rust
|
|
// セットアップ
|
|
fn main() {
|
|
wasm_logger::init(wasm_logger::Config::default());
|
|
}
|
|
|
|
// 使用方法
|
|
log::info!("Update: {:?}", msg);
|
|
```
|
|
|
|
### [`ConsoleService`](https://docs.rs/yew/latest/yew/services/console/struct.ConsoleService.html)
|
|
|
|
このサービスは Yew に含まれており、`"services"`の機能が有効化されている場合は利用可能です。
|
|
|
|
```rust
|
|
// 使用方法
|
|
ConsoleService::info(format!("Update: {:?}", msg).as_ref());
|
|
```
|
|
|
|
## ソースマップ
|
|
|
|
今のところは Rust/Wasm の Web アプリにはソースマップへの第一級のサポートがありません。
|
|
もちろん、これは変更される可能性があります。これが当てはまらない場合、または進捗が見られる場合は、変更を提案してください!
|
|
|
|
### 最新情報
|
|
|
|
\[2019 年 12 月\] [Chrome DevTools update](https://developers.google.com/web/updates/2019/12/webassembly#the_future)
|
|
|
|
> やらなければいけないことがまだたくさんあります。例えばツール側では Emscripten\(Binaryen\)と wasm-pack\(wasm-bindgen\)がそれらが実行する変換に関する DWARF 情報の更新をまだサポートしていません。
|
|
|
|
\[2020\] [Rust Wasm デバッグガイド](https://rustwasm.github.io/book/reference/debugging.html#using-a-debugger)
|
|
|
|
> 残念なことに、WebAssembly のデバッグの物語はまだ未成熟です。ほとんどの Unix のシステムでは[DWARF](http://dwarfstd.org/)は実行中のプログラムをソースレベルで検査するためにデバッガに必要な情報をエンコードするために使用されます。Windows には同様の情報をエンコードする代替形式があります。現在、WebAssembly に相当するものはありません。
|
|
|
|
\[2019\] [Rust Wasm ロードマップ](https://rustwasm.github.io/rfcs/007-2019-roadmap.html#debugging)
|
|
|
|
> デバッグはトリッキーです。なぜなら、多くの話はこの活動チームの手の届かないところにあり、WebAssembly の標準化団体とブラウザ開発者ツールを実装している人たちの両方に依存しているからです。
|