pub fn sanitize_rust_idioms(text: &str, target: DocTarget) -> StringExpand description
Sanitize Rust-specific idioms in a prose string for the given foreign-language documentation target.
Transformations are applied outside backtick spans and code fences only,
so inline code examples and fenced blocks are never mutated (except that
```rust fences and unmarked ``` code blocks are dropped entirely
for all targets DocTarget::TsDoc, DocTarget::JsDoc, DocTarget::PhpDoc,
DocTarget::JavaDoc, and DocTarget::CSharpDoc).
§Transformations
- Intra-doc links
[`Type::method`]→`Type.method`. [Foo](backtick inside square brackets) →`Foo`.None(word boundary) →null(PHP/Java) orundefined(TS/JS).Some(x)→the value (x).Option<T>→T?(PHP) /T | null(Java) /T | undefined(TS/JS).Vec<u8>→string(PHP) /byte[](Java) /Uint8Array(TS/JS).Vec<T>→T[](all targets).HashMap<K, V>→array<K, V>(PHP) /Map<K, V>(Java) /Record<K, V>(TS/JS).Arc<T>,Box<T>,Mutex<T>,RwLock<T>,Rc<T>,Cell<T>,RefCell<T>→T.Send + Sync,Send,Sync,'static→ stripped.- Standalone
::between identifiers →.. pub fn,crate::,&self,&mut self→ stripped.#[…]attribute macros on their own line or inline → stripped..unwrap(),.expect("…")→ stripped.```rustand unmarked```code fences → dropped entirely.