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

Crate docs for apis module #265

Merged

Conversation

josecelano
Copy link
Member

Documentation for the crate::servers::apis module.

@josecelano josecelano linked an issue Mar 28, 2023 that may be closed by this pull request
@josecelano josecelano force-pushed the issue-263-crate-docs-for-apis-mod branch 6 times, most recently from 51afb87 to 33391b0 Compare March 28, 2023 15:07
@@ -412,7 +413,7 @@
//!
//! For example, the HTTP tracker would send an event like the following when it handles an `announce` request received from a peer using IP version 4.
//!
//! ```rust,ignore
//! ```text
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the changing from rust,ignore to text?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not want to compile that piece of code, and I do not want to have an "ignore" test in the output like this:

& cargo test --doc
test src/tracker/mod.rs - tracker (line 83) - compile ... ignore

Sometimes the necessary setup to compile is too verbose for the documentation. For example:

let announce_data = tracker.announce(&info_hash, &mut peer, &peer_ip).await;

That line would require building a tracker, a peer, etc.

We have the tests if you want to check a fully operational example; maybe I could add a link to the tests in these cases.

I can also implement the full working example and hide the lines that are not interesting for the documentation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link to how to hide code in docs is wrong. I've read somewhere else that you can do that, but I do not find it.

Copy link
Member Author

@josecelano josecelano Mar 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link was not wrong it's only that you need to prepend the hashtag to all the lines you want to hide:

//! ```rust,no_run
//! # use torrust_tracker::tracker::peer;
//! # use torrust_tracker::shared::bit_torrent::info_hash::InfoHash;
//! # // ...
//! 
//! let announce_data = tracker.announce(&info_hash, &mut peer, &peer_ip).await;
//! ```

That would show only:

let announce_data = tracker.announce(&info_hash, &mut peer, &peer_ip).await;

@josecelano josecelano force-pushed the issue-263-crate-docs-for-apis-mod branch 3 times, most recently from f02fb43 to edcd5e4 Compare March 28, 2023 16:31
@josecelano josecelano requested a review from mickvandijke March 28, 2023 16:39
@josecelano josecelano added the Documentation Improves Instructions, Guides, and Notices label Mar 28, 2023
@josecelano
Copy link
Member Author

Hey, @da2ce7 @WarmBeer, I'm not going to include in the API docs information about how to set up Nginx or Apache as reverse proxies, with or without SSL. I think we can move that information to blog posts (tutorials) on the torrust.com site.

@josecelano josecelano force-pushed the issue-263-crate-docs-for-apis-mod branch 5 times, most recently from acccc53 to 2ce17b0 Compare March 29, 2023 15:47
@josecelano josecelano force-pushed the issue-263-crate-docs-for-apis-mod branch from 2ce17b0 to 81c4d70 Compare March 29, 2023 17:36
@josecelano josecelano marked this pull request as ready for review March 29, 2023 17:41
@josecelano
Copy link
Member Author

ACK 81c4d70

@josecelano
Copy link
Member Author

Hi @da2ce7 @WarmBeer, this is ready to review.

@josecelano josecelano merged commit 15779a5 into torrust:develop Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Improves Instructions, Guides, and Notices
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

crate docs: for servers::apismod (Tracker API)
2 participants