I have a crate that's #![no_std]
, but the docs have links to objects in std
because it's helpful to explain things.
Is there a general way to use
a crate for the purposes of resolving doc links, so that this works?
A link to a [HashMap].
And if not, is there a recommended best practice to do a full path reference? I.e. is there a better way than this?
A link to a [HashMap](https://doc.rust-lang.org/std/collections/struct.HashMap.html).
Thanks.
1 Like
Something like this should work
#![cfg_attr(not(doc), no_std)]
#[cfg(doc)]
use std::collections::HashMap;
/// Refer to [HashMap]
pub fn foo() {}
3 Likes
kpreid
4
I suggest using instead:
#[cfg(doc)]
extern crate std;
It's less of a double-negative, and doesn't activate the std prelude, so all of your mentions of std
remain qualified.
4 Likes
system
Closed
5
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.