docs/usage.md
Here, I describe how to use RustOwl in your workflow.
First, please install the RustOwl LSP server and extension for your editor. Installation guide is on installation file.
Then, please open a Rust source code file (.rs) in the editor.
RustOwl only works with a Cargo workspace, so you need to open the source code that is part of a Cargo workspace.
I recommend you try RustOwl with a small, simple workspace first.
RustOwl's analysis may take a long time for a large workspace.
VS Code extension will automatically start analyzing the workspace. For other editors, you may need to enable RustOwl manually, but you can enable automatic loading in your configuration file. The progress of analysis will be shown in your editor.
After the analysis started, RustOwl waits for your request. Please place the text cursor on a variable or function call you would like to inspect. RustOwl works for the analyzed portion, even if the entire analysis has not finished. If your program has some fatal errors (e.g., syntax errors or unrecoverable type errors), RustOwl cannot work for the part where the analysis failed.
Wait for a few seconds, and then the ownership-related operations and lifetimes of the variable to which the unwrap() method call assigns a value will appear.
Basically, RustOwl can be used to resolve ownership and lifetime errors. What RustOwl visualizes is:
You can see which color is assigned to them on the top page of this repository. RustOwl can be used to see where a variable lives, where it dies, and where it is borrowed or moved.
For VS Code, you can see the message that explains the meaning of the underline by hovering your mouse cursor over it.
This is the basic usage of RustOwl! Now you have a master's degree in RustOwl.
The lifetime that RustOwl visualizes is the range of these variables:
Based on this, we can use RustOwl as listed below:
Mutex
Did you get a Ph.D. in lifetimes? So let's try managing resources with RustOwl. You will get a Ph.D. in RustOwl and computer resource management.