diff options
| author | binarycat <binarycat@envs.net> | 2025-03-10 14:29:08 -0500 |
|---|---|---|
| committer | binarycat <binarycat@envs.net> | 2025-03-10 15:00:36 -0500 |
| commit | 749b6bf79f0fb1cfa3d2ba12f3ae2f1cf0f374d0 (patch) | |
| tree | 01aefd2d218810c0be587a6b45c57506c9c898ff /src/librustdoc/html/static/js | |
| parent | 2e1c8f088aa9b422490449a92466b71c4f115819 (diff) | |
| download | rust-749b6bf79f0fb1cfa3d2ba12f3ae2f1cf0f374d0.tar.gz rust-749b6bf79f0fb1cfa3d2ba12f3ae2f1cf0f374d0.zip | |
rustdoc.d.ts: add window.{register_implementors,pending_implementors}
Diffstat (limited to 'src/librustdoc/html/static/js')
| -rw-r--r-- | src/librustdoc/html/static/js/main.js | 3 | ||||
| -rw-r--r-- | src/librustdoc/html/static/js/rustdoc.d.ts | 17 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index b475e6418a7..26639a85601 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -673,7 +673,6 @@ function preLoadCss(cssUrl) { } // <https://github.com/search?q=repo%3Arust-lang%2Frust+[RUSTDOCIMPL]+trait.impl&type=code> - // @ts-expect-error window.register_implementors = imp => { const implementors = document.getElementById("implementors-list"); const synthetic_implementors = document.getElementById("synthetic-implementors-list"); @@ -765,9 +764,7 @@ function preLoadCss(cssUrl) { } } }; - // @ts-expect-error if (window.pending_implementors) { - // @ts-expect-error window.register_implementors(window.pending_implementors); } diff --git a/src/librustdoc/html/static/js/rustdoc.d.ts b/src/librustdoc/html/static/js/rustdoc.d.ts index def0bd4f71e..4504642480b 100644 --- a/src/librustdoc/html/static/js/rustdoc.d.ts +++ b/src/librustdoc/html/static/js/rustdoc.d.ts @@ -44,6 +44,15 @@ declare global { * Set up event listeners for a scraped source example. */ updateScrapedExample?: function(HTMLElement, HTMLElement), + /** + * register trait implementors, called by code generated in + * `write_shared.rs` + */ + register_implementors?: function(Implementors): void, + /** + * fallback in case `register_implementors` isn't defined yet. + */ + pending_implementors?: Implementors, } interface HTMLElement { /** Used by the popover tooltip code. */ @@ -415,4 +424,12 @@ declare namespace rustdoc { }; type VlqData = VlqData[] | number; + + /** + * Maps from crate names to trait implementation data. + * Provied by generated `trait.impl` files. + */ + type Implementors = { + [key: string]: Array<[string, number, Array<string>]> + } } |
