'How to escape a closing tag in block comments /** */?

I want to have an example regex in a comment:

/**
 * Example = ".*/full/.*" }}`
*/
pub fn my_fun() {}

I get a broken comment since */ is considered as ending the comment.

What would be a proper way to escape this so that some autogenerated docs don't display the escape character?

Example from VSCode



Solution 1:[1]

You can do something like

/**
 * Example = ".\*\/full/.*" }}
 */
pub fn my_fun(){}

It'll get rendered as

enter image description here

This should do.

But the recommended ways in rust are

https://doc.rust-lang.org/book/ch03-04-comments.html https://doc.rust-lang.org/book/ch14-02-publishing-to-crates-io.html#making-useful-documentation-comments

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1