Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Want to quickly put dbg! into external crates?

Want to quickly put dbg! into external crates?

nakabonne

May 19, 2021
Tweet

More Decks by nakabonne

Other Decks in Programming

Transcript

  1. Want to quickly put dbg! into external
    crates?

    Rust LT Online #3

    View full-size slide

  2. 自己紹介
    ● 中尾 涼 (@nakabonne)
    ● 普段: Go
    ● Rust歴1ヶ月程度

    View full-size slide

  3. 書き始めて思ったこと
    ● 依存ライブラリの挙動をデバッグしたい
    ○ dbg!を外部クレートに書きたい
    ● 外部クレートにパッチを送る際少し面倒
    → シュッといじって、サッと捨てたい

    View full-size slide

  4. 簡単に解決できそう
    ● ローカルの被参照クレートをコピー (.cargo/registry/src/)
    ● Cargo.tomlのASTをいじって dependencies の参照先をそこに向ける
    ● 向き先を戻すにはCargo.tomlをUndoするだけ

    View full-size slide

  5. rhack - github.com/nakabonne/rhack

    View full-size slide

  6. rhack - github.com/nakabonne/rhack

    View full-size slide

  7. rhack - github.com/nakabonne/rhack

    View full-size slide

  8. Good first issues
    ● Add flag to undo to only undo specific package #3
    ○ rhack undo reqwest
    ● Add flag to also delete local file contents #4
    ○ rhack undo --purge

    View full-size slide

  9. まとめ
    Rustの基礎知識、コミュニティの温かさを知ることが出来ました

    View full-size slide