Skip to main content

example_for_target

Function example_for_target 

Source
pub fn example_for_target(example: &str, target_lang: &str) -> Option<String>
Expand description

Return Some(transformed_example) if the example should be emitted for target_lang, or None when the example is Rust source that would be meaningless in the foreign language.

When the original fence language is rust (including bare ``` which rustdoc defaults to Rust) and the target is not rust, the example is suppressed entirely — better absent than misleading. Cross-language transliteration of example bodies is intentionally out of scope.