-
Notifications
You must be signed in to change notification settings - Fork 44
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
Crate docs for apis
module
#265
Conversation
51afb87
to
33391b0
Compare
@@ -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 |
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.
Why the changing from rust,ignore
to text
?
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.
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.
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.
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.
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.
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;
f02fb43
to
edcd5e4
Compare
acccc53
to
2ce17b0
Compare
2ce17b0
to
81c4d70
Compare
ACK 81c4d70 |
Documentation for the
crate::servers::apis
module.