Skip to content
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

Fix argument inconsistency in example documentation #1208

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bahamat
Copy link

@bahamat bahamat commented Dec 21, 2024

The "bare minimum" example has (among other things) this:

    let server = ServerBuilder::new(api, Arc::new(()), log)
        .start()
        .map_err(|error| format!("failed to start server: {}", error))?;

Then later the examples for registering APIs (both as a free function and as an API trait) don't wrap the argument in Arc<>.

This leads new users into a trap where these two (three) disconnected examples seem like they should work, but lead to a compile error once they add a handler.

Discussing with @davepacheco, it seems the consensus is that Arc is not particularly recommended here anymore.

This change will help new users walk right into a working example, rather than encountering an error.

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.

1 participant