-
Notifications
You must be signed in to change notification settings - Fork 70
refactor(lang/rust): rust language guide #310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
refactor(lang/rust): rust language guide #310
Conversation
This commit heavily refactors the rust language guide, accomplishing a few goals: - Moving from `cargo component` to native rust toolchain - Removing sections with advanced funtionality
Lots of discussion/help wanted here: @kate-goldenring @mkatychev @macovedj @itowlson . In converting the current docs off of The goal is not to remove those other sections completely, but rather to move them to other parts of the book as necessary, and keep the initial component building relatively light/easy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking really close. Just some nits and help filling out a TODO
Co-authored-by: Kate Goldenring <[email protected]>
Co-authored-by: Kate Goldenring <[email protected]>
Co-authored-by: Kate Goldenring <[email protected]>
Co-authored-by: Kate Goldenring <[email protected]>
Co-authored-by: Kate Goldenring <[email protected]>
Co-authored-by: Kate Goldenring <[email protected]>
Co-authored-by: Kate Goldenring <[email protected]>
Co-authored-by: Kate Goldenring <[email protected]>
Co-authored-by: Kate Goldenring <[email protected]>
Co-authored-by: Mikhail Katychev <[email protected]>
Co-authored-by: Mikhail Katychev <[email protected]>
Co-authored-by: Mikhail Katychev <[email protected]>
Co-authored-by: Kate Goldenring <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like large sections of the rust guide were removed. Is there a reason for that? Can we retain that information on how to use interfaces, resources, and WIT types?
} | ||
``` | ||
|
||
### Implementing and exporting a resource in a component |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this section on using resources was removed?
``` | ||
After compiling in release mode, we get a much smaller binary: | ||
|
||
## Using user-defined types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this section was removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah see this comment: #310 (comment)
Which links to the description of the PR
Basically, we could keep these sections in, but I really don't think we should -- it feels like these sections should go somewhere else, since they start to veer quite quickly from building & running the simple component.
|
||
> **WARNING:** If your program prints to standard out or error, you may not see the printed output! Some versions of `wasmtime` have a bug where they don't flush output streams before exiting. To work around this, add a `std::thread::sleep()` with a 10 millisecond delay before exiting `main`. | ||
### Importing an interface into a command component |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason this section was removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah see the description of this PR, I was thinking we would need to discuss this
Co-authored-by: Kate Goldenring <[email protected]>
This commit heavily refactors the rust language guide, accomplishing a few goals:
cargo component
to native rust toolchainWe're probably going to have to heavily discuss this, but I'm putting this PR up so we have something concrete do discuss.
We likely need:
With regards to (1), the initial language guide seems really well served by the basic component + run example. It's easy to understand, and a quick win for the average new reader. Adding in imports and composition into the
calculator
component really feels like a step 2/more advanced guide that we should separate out and let people navigate to.With regards to (2), many of the advanced sections at the bottom (type mappings, etc) really also feel like they should have their own sections. For example type mappings feels more like a reference and just doesn't make sense in the "creating components" section.
Maybe this isn't the right PR for this discussion, but it really might be more fitting to rename the "creating components" section to "Build a basic component" or something along those lines.
I'm happy to "just" convert the existing documentation 1:1 to work without cargo component, but IMO we really risk people getting lost/giving up in the middle of a very long introduction/getting started-ish page.