| 1 | //! Simple Doxygen to Rustdoc translation. |
| 2 | //! |
| 3 | //! Provides a simple and straightforward API to translate _raw_ Doxygen comments to Rustdoc |
| 4 | //! comments. Purely experimental right now, maybe practical in a future? |
| 5 | //! |
| 6 | //! # Examples |
| 7 | //! |
| 8 | //! ``` |
| 9 | //! use doxygen_rs::transform; |
| 10 | //! |
| 11 | //! let rustdoc = transform("@brief Example Doxygen brief"); |
| 12 | //! assert_eq!(rustdoc, "Example Doxygen brief"); |
| 13 | //! ``` |
| 14 | //! |
| 15 | //! # Usage with bindgen >= 0.63 |
| 16 | //! |
| 17 | //! ``` |
| 18 | //! # trait ParseCallbacks { |
| 19 | //! # fn process_comment(&self, comment: &str) -> Option<String>; |
| 20 | //! # } |
| 21 | //! #[derive(Debug)] |
| 22 | //! struct Cb; |
| 23 | //! |
| 24 | //! impl ParseCallbacks for Cb { |
| 25 | //! fn process_comment(&self, comment: &str) -> Option<String> { |
| 26 | //! Some(doxygen_rs::transform(comment)) |
| 27 | //! } |
| 28 | //! } |
| 29 | //! ``` |
| 30 | |
| 31 | mod emojisrust-analyzer cargo doxygen-rs 0.4.2 emojis/; |
| 32 | pub mod generatorrust-analyzer cargo doxygen-rs 0.4.2 generator/; |
| 33 | mod lexerrust-analyzer cargo doxygen-rs 0.4.2 lexer/; |
| 34 | mod parserrust-analyzer cargo doxygen-rs 0.4.2 parser/; |
| 35 | |
| 36 | /// This function transforms the Doxygen of a single element (function, struct, etc.) |
| 37 | /// |
| 38 | /// # Panics |
| 39 | /// |
| 40 | /// This function will panic if any error from [`generator::rustdoc`] is returned. |
| 41 | pub fn transformrust-analyzer cargo doxygen-rs 0.4.2 transform().(value: &str) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 42 | generatorrust-analyzer cargo doxygen-rs 0.4.2 generator/::rustdocrust-analyzer cargo doxygen-rs 0.4.2 generator/rustdoc().(value.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("failed to transform the comments") |
| 43 | } |