Conversation
51afb87 to
33391b0
Compare
| //! 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.
Why the changing from rust,ignore to text?
There was a problem hiding this comment.
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.
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.
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::apismodule.