Debian Codegraph @

src/generator.rs

raw symbols SCIP
1 use craterust-analyzer cargo doxygen-rs 0.4.2 crate/::emojisrust-analyzer cargo doxygen-rs 0.4.2 emojis/;
2 use craterust-analyzer cargo doxygen-rs 0.4.2 crate/::parserrust-analyzer cargo doxygen-rs 0.4.2 parser/::{parserust-analyzer cargo doxygen-rs 0.4.2 parser/parse()., GrammarItemrust-analyzer cargo doxygen-rs 0.4.2 parser/GrammarItem#, ParseErrorrust-analyzer cargo doxygen-rs 0.4.2 parser/ParseError#};
3
4 /// Creates a Rustdoc string from a Doxygen string.
5 ///
6 /// # Errors
7 ///
8 /// This function can error if there are missing parts of a given Doxygen annotation (like `@param`
9 /// missing the variable name)
10 pub fn rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/rustdoc().(input: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, ParseErrorrust-analyzer cargo doxygen-rs 0.4.2 parser/ParseError#> {
11 let parsed = parserust-analyzer cargo doxygen-rs 0.4.2 parser/parse().(input)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
12 let mut result = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().();
13 let mut already_added_params = false;
14 let mut already_added_returns = false;
15 let mut already_added_throws = false;
16 let mut group_started = false;
17
18 for item in parsed {
19 result rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&match item {
20 GrammarItemrust-analyzer cargo doxygen-rs 0.4.2 parser/GrammarItem#::Notationrust-analyzer cargo doxygen-rs 0.4.2 parser/GrammarItem#Notation# { metarust-analyzer cargo doxygen-rs 0.4.2 parser/GrammarItem#Notation#meta., paramsrust-analyzer cargo doxygen-rs 0.4.2 parser/GrammarItem#Notation#params., tagrust-analyzer cargo doxygen-rs 0.4.2 parser/GrammarItem#Notation#tag. } => {
21 let (str, (added_param, added_return, added_throws)) = generate_notationrust-analyzer cargo doxygen-rs 0.4.2 generator/generate_notation().(
22 tag,
23 meta,
24 params,
25 (
26 already_added_params,
27 already_added_returns,
28 already_added_throws,
29 ),
30 );
31 if added_param {
32 already_added_params = true;
33 }
34
35 if added_return {
36 already_added_returns = true;
37 }
38
39 if added_throws {
40 already_added_throws = true;
41 }
42
43 str
44 }
45 GrammarItemrust-analyzer cargo doxygen-rs 0.4.2 parser/GrammarItem#::Textrust-analyzer cargo doxygen-rs 0.4.2 parser/GrammarItem#Text#(v) => if group_started {
46 v.replacenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]replacen().("*", "", 1)
47 } else {
48 v
49 },
50 // See <https://stackoverflow.com/a/40354789>
51 GrammarItemrust-analyzer cargo doxygen-rs 0.4.2 parser/GrammarItem#::GroupStartrust-analyzer cargo doxygen-rs 0.4.2 parser/GrammarItem#GroupStart# => {
52 group_started = true;
53 Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("# ")
54 },
55 GrammarItemrust-analyzer cargo doxygen-rs 0.4.2 parser/GrammarItem#::GroupEndrust-analyzer cargo doxygen-rs 0.4.2 parser/GrammarItem#GroupEnd# => {
56 group_started = false;
57 continue
58 },
59 };
60 }
61
62 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(result)
63 }
64
65 fn generate_notationrust-analyzer cargo doxygen-rs 0.4.2 generator/generate_notation().(
66 tag: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
67 meta: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
68 params: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
69 (already_params, already_returns, already_throws): (bool, bool, bool),
70 ) -> (Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, (bool, bool, bool)) {
71 let mut new_param = false;
72 let mut new_return = false;
73 let mut new_throw = false;
74
75 (
76 match tag.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().() {
77 "param" => {
78 let param = params.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(0);
79 new_param = true;
80 let mut str = if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().already_params {
81 "# Arguments\n\n".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
82 } else {
83 Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().()
84 };
85
86 str rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(param) = param {
87 if meta.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
88 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("* `{param}` -")
89 } else {
90 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(second) = meta.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(1) {
91 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
92 "* `{}` (direction {}, {}) -",
93 param,
94 meta.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
95 second
96 )
97 } else {
98 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("* `{}` (direction {}) -", param, meta.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())
99 }
100 }
101 } else {
102 Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().()
103 };
104
105 str
106 }
107 "a" | "e" | "em" => {
108 let word = params
109 .getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(0)
110 .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("@a/@e/@em doesn't contain a word to style");
111 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("_{word}_")
112 }
113 "b" => {
114 let word = params.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(0).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("@b doesn't contain a word to style");
115 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("**{word}**")
116 }
117 "c" | "p" => {
118 let word = params
119 .getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(0)
120 .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("@c/@p doesn't contain a word to style");
121 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("`{word}`")
122 }
123 "emoji" => {
124 let word = params.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(0).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("@emoji doesn't contain an emoji");
125 emojisrust-analyzer cargo doxygen-rs 0.4.2 emojis/::EMOJISrust-analyzer cargo doxygen-rs 0.4.2 emojis/EMOJIS.
126 .getrust-analyzer cargo phf 0.11.3 map/impl#[`Map<K, V>`]get().(&word.replacerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]replace().(':', ""))
127 .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("invalid emoji")
128 .to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()
129 }
130 "sa" | "see" => {
131 let code_ref = params.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(0).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("@sa/@see doesn't contain a reference");
132 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("[`{code_ref}`]")
133 }
134 "retval" => {
135 let var = params.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(0).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("@retval doesn't contain a parameter");
136 new_return = true;
137 let mut str = if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().already_returns {
138 "# Returns\n\n".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
139 } else {
140 Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().()
141 };
142
143 str rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("* `{var}` -");
144 str
145 }
146 "returns" | "return" | "result" => {
147 new_return = true;
148 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().already_returns {
149 "# Returns\n\n".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
150 } else {
151 Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().()
152 }
153 }
154 "throw" | "throws" | "exception" => {
155 new_throw = true;
156 let exception = params.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(0).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("@param doesn't contain a parameter");
157
158 let mut str = if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().already_throws {
159 "# Throws\n\n".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
160 } else {
161 Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().()
162 };
163
164 str rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("* [`{exception}`] -");
165 str
166 }
167 "note" => Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("> **Note:** "),
168 "since" => Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("> Available since: "),
169 "deprecated" => Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("> **Deprecated** "),
170 "remark" | "remarks" => Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("> "),
171 "par" => Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("# "),
172 "details" | "pre" | "post" => Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("\n\n"),
173 "brief" | "short" => Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(),
174 _ => Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(),
175 },
176 (new_param, new_return, new_throw),
177 )
178 }
179
180 #[cfg(test)]
181 mod testrust-analyzer cargo doxygen-rs 0.4.2 generator/test/ {
182 use superrust-analyzer cargo doxygen-rs 0.4.2 generator/::*;
183
184 macro_rules! test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc! {
185 ($input:literal, $expected:literal) => {
186 let result = $crate::generator::rustdoc($input.into()).unwrap();
187 assert_eq!(result, $expected);
188 };
189 }
190
191 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
192 fn unknown_annotationrust-analyzer cargo doxygen-rs 0.4.2 generator/test/unknown_annotation().() {
193 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!("@thisdoesntexist Example doc", "Example doc");
194 }
195
196 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
197 fn param_with_directionrust-analyzer cargo doxygen-rs 0.4.2 generator/test/param_with_direction().() {
198 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
199 "@param[in] example This insane thing.",
200 "# Arguments\n\n* `example` (direction in) - This insane thing."
201 );
202
203 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
204 "@param[in,out] example This insane thing.",
205 "# Arguments\n\n* `example` (direction in, out) - This insane thing."
206 );
207
208 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
209 "@param[out,in] example This insane thing.",
210 "# Arguments\n\n* `example` (direction in, out) - This insane thing."
211 );
212 }
213
214 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
215 fn param_without_directionrust-analyzer cargo doxygen-rs 0.4.2 generator/test/param_without_direction().() {
216 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
217 "@param example This is definitively an example!",
218 "# Arguments\n\n* `example` - This is definitively an example!"
219 );
220 }
221
222 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
223 fn multiple_paramsrust-analyzer cargo doxygen-rs 0.4.2 generator/test/multiple_params().() {
224 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
225 "@param example1 This is the first example\n@param[out] example2 This is the second example\n@param[in] example3 This is the third example.",
226 "# Arguments\n\n* `example1` - This is the first example\n* `example2` (direction out) - This is the second example\n* `example3` (direction in) - This is the third example."
227 );
228 }
229
230 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
231 fn italicsrust-analyzer cargo doxygen-rs 0.4.2 generator/test/italics().() {
232 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
233 "This @a thing is without a doubt @e great. @em And you won't tell me otherwise.",
234 "This _thing_ is without a doubt _great._ _And_ you won't tell me otherwise."
235 );
236 }
237
238 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
239 fn boldrust-analyzer cargo doxygen-rs 0.4.2 generator/test/bold().() {
240 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!("This is a @b bold claim.", "This is a **bold** claim.");
241 }
242
243 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
244 fn code_inlinerust-analyzer cargo doxygen-rs 0.4.2 generator/test/code_inline().() {
245 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
246 "@c u8 is not the same as @p u32",
247 "`u8` is not the same as `u32`"
248 );
249 }
250
251 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
252 fn emojirust-analyzer cargo doxygen-rs 0.4.2 generator/test/emoji().() {
253 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!("@emoji :relieved: @emoji :ok_hand:", "😌 👌");
254 }
255
256 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
257 fn text_stylingrust-analyzer cargo doxygen-rs 0.4.2 generator/test/text_styling().() {
258 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
259 "This is from @a Italy. ( @b I @c hope @emoji :pray: )",
260 "This is from _Italy._ ( **I** `hope` 🙏 )"
261 );
262 }
263
264 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
265 fn briefrust-analyzer cargo doxygen-rs 0.4.2 generator/test/brief().() {
266 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
267 "@brief This function does things.\n@short This function also does things.",
268 "This function does things.\nThis function also does things."
269 );
270 }
271
272 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
273 fn see_alsorust-analyzer cargo doxygen-rs 0.4.2 generator/test/see_also().() {
274 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
275 "@sa random_thing @see random_thing_2",
276 "[`random_thing`] [`random_thing_2`]"
277 );
278 }
279
280 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
281 fn deprecatedrust-analyzer cargo doxygen-rs 0.4.2 generator/test/deprecated().() {
282 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
283 "@deprecated This function is deprecated!\n@param example_1 Example 1.",
284 "> **Deprecated** This function is deprecated!\n# Arguments\n\n* `example_1` - Example 1."
285 );
286 }
287
288 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
289 fn detailsrust-analyzer cargo doxygen-rs 0.4.2 generator/test/details().() {
290 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
291 "@brief This function is insane!\n@details This is an insane function because its functionality and performance is quite astonishing.",
292 "This function is insane!\n\n\nThis is an insane function because its functionality and performance is quite astonishing."
293 );
294 }
295
296 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
297 fn paragraphrust-analyzer cargo doxygen-rs 0.4.2 generator/test/paragraph().() {
298 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
299 "@par Interesting fact about this function\nThis is a function.",
300 "# Interesting fact about this function\nThis is a function."
301 );
302 }
303
304 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
305 fn remarkrust-analyzer cargo doxygen-rs 0.4.2 generator/test/remark().() {
306 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
307 "@remark This things needs to be\n@remark remarked.",
308 "> This things needs to be\n> remarked."
309 );
310 }
311
312 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
313 fn returnsrust-analyzer cargo doxygen-rs 0.4.2 generator/test/returns().() {
314 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
315 "@returns A value that should be\n@return used with caution.\n@result And if it's @c -1 ... run.",
316 "# Returns\n\nA value that should be\nused with caution.\nAnd if it's `-1` ... run."
317 );
318 }
319
320 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
321 fn return_valuerust-analyzer cargo doxygen-rs 0.4.2 generator/test/return_value().() {
322 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
323 "@retval example1 This return value is great!",
324 "# Returns\n\n* `example1` - This return value is great!"
325 );
326 }
327
328 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
329 fn returns_and_return_valuerust-analyzer cargo doxygen-rs 0.4.2 generator/test/returns_and_return_value().() {
330 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
331 "@returns Great values!\n@retval example1 Is this an example?\n@return Also maybe more things (?)",
332 "# Returns\n\nGreat values!\n* `example1` - Is this an example?\nAlso maybe more things (?)"
333 );
334
335 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
336 "@returns Great values!\n@return Also maybe more things (?)\n@retval example1 Is this an example?",
337 "# Returns\n\nGreat values!\nAlso maybe more things (?)\n* `example1` - Is this an example?"
338 );
339
340 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
341 "@retval example1 Is this an example?\n@returns Great values!\n@return Also maybe more things (?)",
342 "# Returns\n\n* `example1` - Is this an example?\nGreat values!\nAlso maybe more things (?)"
343 );
344 }
345
346 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
347 fn sincerust-analyzer cargo doxygen-rs 0.4.2 generator/test/since().() {
348 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
349 "@since The bite of '87",
350 "> Available since: The bite of '87"
351 );
352 }
353
354 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
355 fn throwsrust-analyzer cargo doxygen-rs 0.4.2 generator/test/throws().() {
356 test_rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/test/test_rustdoc!!(
357 "@throw std::io::bonk This is thrown when INSANE things happen.\n@throws std::net::meow This is thrown when BAD things happen.\n@exception std::fs::no This is thrown when NEFARIOUS things happen.",
358 "# Throws\n\n* [`std::io::bonk`] - This is thrown when INSANE things happen.\n* [`std::net::meow`] - This is thrown when BAD things happen.\n* [`std::fs::no`] - This is thrown when NEFARIOUS things happen."
359 );
360 }
361
362 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
363 fn can_parse_examplerust-analyzer cargo doxygen-rs 0.4.2 generator/test/can_parse_example().() {
364 let example = include_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/include_str!!("../tests/assets/example-bindgen.rs");
365 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{}", rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/rustdoc().(example.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().());
366 }
367 }