File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -141,8 +141,15 @@ not documented and document it. Include the docs via lib.rs per previous crates.
1411413 . ** Create documentation file:** ` crates/rustmax/doc-src/crate-NAME.md `
142142 - follow existing conventions to create content
1431434 . ** Update lib.rs:** replace module contents per other crates
144- 5 . ** Update linksubs.json5:** Add entries for any cross-references in your documentation
145- 6 . ** Test with ` just doc-crates ` :** Run and check for "unreplaced link" warnings
144+ 5 . ** Update linksubs.json5:** The crate docs are rendered in two contexts:
145+ as rustdoc module docs (where ` crate:: ` links resolve automatically),
146+ and as standalone HTML on the crates.html page (where they don't).
147+ ` src/linksubs.json5 ` maps ` crate:: ` rustdoc link targets to actual HTML paths
148+ so they work on crates.html. Every ` crate:: ` link reference definition
149+ in your doc file (the ` [ ` Foo` ]: crate::bar::Foo ` lines at the bottom)
150+ needs a corresponding entry in linksubs.json5 unless one already exists.
151+ The value is the relative HTML path, e.g. ` "api/some_crate/struct.Foo.html" ` .
152+ 6 . ** Test with ` just doc-api ` :** Run and check for warnings
1461537 . ** Verify crates.json5:** Usually already has the crate entry, but check it has appropriate metadata
147154
148155Examples should be runnable. Test with
Original file line number Diff line number Diff line change 1+ Quasi-quoting for generating Rust source code as tokens.
2+
3+ - Crate [ ` ::quote ` ] .
4+ - [ docs.rs] ( https://docs.rs/quote )
5+ - [ crates.io] ( https://crates.io/crates/quote )
6+ - [ GitHub] ( https://github.com/dtolnay/quote )
7+
8+ ---
9+
10+ ` quote ` provides the [ ` quote! ` ] macro,
11+ which turns Rust syntax into a [ ` proc_macro2::TokenStream ` ] .
12+ It is one of the three foundational crates for writing procedural macros,
13+ alongside [ ` syn ` ] for parsing and [ ` proc_macro2 ` ] for token representation.
14+
15+ The ` quote! ` macro supports interpolation of variables with ` #var `
16+ and repetition with ` #( ... )* ` , mirroring the patterns of ` macro_rules! ` .
17+
18+ ## Example
19+
20+ Generating a token stream with interpolation:
21+
22+ ``` rust
23+ use quote :: quote;
24+ use proc_macro2 :: Ident ;
25+
26+ let name = Ident :: new (" Greeter" , proc_macro2 :: Span :: call_site ());
27+ let field_name = Ident :: new (" message" , proc_macro2 :: Span :: call_site ());
28+
29+ let tokens = quote! {
30+ struct #name {
31+ #field_name : String ,
32+ }
33+ };
34+
35+ let code = tokens . to_string ();
36+ assert! (code . contains (" struct Greeter" ));
37+ assert! (code . contains (" message : String" ));
38+ ```
39+
40+ [ `quote!` ] : crate::quote::quote
41+ [ `proc_macro2::TokenStream` ] : crate::proc_macro2::TokenStream
42+ [ `syn` ] : crate::syn
43+ [ `proc_macro2` ] : crate::proc_macro2
Original file line number Diff line number Diff line change @@ -568,9 +568,7 @@ pub mod proptest {
568568
569569#[ cfg( feature = "quote" ) ]
570570pub mod quote {
571- //! The `quote!` macro for turning code blocks into source tokens.
572- //!
573- //! See crate [`::quote`].
571+ #![ doc = include_str ! ( "../doc-src/crate-quote.md" ) ]
574572
575573 pub use :: quote:: * ;
576574}
Original file line number Diff line number Diff line change 639639 "crate::std::ffi" :
640640 "api/std/ffi/index.html" ,
641641
642+ // cfg-if
643+ "crate::cfg_if::cfg_if" :
644+ "api/cfg_if/macro.cfg_if.html" ,
645+
646+ // extension-trait
647+ "crate::extension_trait::extension_trait" :
648+ "api/extension_trait/attr.extension_trait.html" ,
649+
650+ // rand_chacha
651+ "crate::rand_chacha::ChaCha20Rng" :
652+ "api/rand_chacha/struct.ChaCha20Rng.html" ,
653+ "crate::rand_chacha::ChaCha8Rng" :
654+ "api/rand_chacha/struct.ChaCha8Rng.html" ,
655+
656+ // rand_pcg
657+ "crate::rand_pcg::Pcg32" :
658+ "api/rand_pcg/type.Pcg32.html" ,
659+
660+ // quote
661+ "crate::quote::quote" :
662+ "api/quote/macro.quote.html" ,
663+ "crate::proc_macro2::TokenStream" :
664+ "api/proc_macro2/struct.TokenStream.html" ,
665+ "crate::syn" :
666+ "api/rustmax/syn/index.html" ,
667+ "crate::proc_macro2" :
668+ "api/rustmax/proc_macro2/index.html" ,
669+
642670 // zip
643671 "crate::zip::ZipArchive" :
644672 "api/zip/read/struct.ZipArchive.html" ,
You can’t perform that action at this time.
0 commit comments