Skip to content

Conversation

vados-cosmonic
Copy link
Collaborator

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

We'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:

  1. New section(s) for the "calculator" phase/step 2 of the guide
  2. New structure for the "advanced" pieces

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.

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
@vados-cosmonic
Copy link
Collaborator Author

Lots of discussion/help wanted here: @kate-goldenring @mkatychev @macovedj @itowlson .

In converting the current docs off of cargo component (since it's being deprecated), it really felt right to just leave the guide at creating the adder component. This is obviously a much larger change than first intended but I'd like to discuss it.

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.

Copy link
Collaborator

@kate-goldenring kate-goldenring left a 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

Copy link
Collaborator

@kate-goldenring kate-goldenring left a 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
Copy link
Collaborator

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
Copy link
Collaborator

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?

Copy link
Collaborator Author

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
Copy link
Collaborator

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?

Copy link
Collaborator Author

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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants