docs(assets): correct the icon bundle docs - #88
Merged
Merged
Conversation
The readme still called this package the Longbridge GPUI Component asset bundle, and the crate docs said WASM icons come from a CDN via web_sys::Request. The package is moon-ui-components-assets. Native builds embed the SVGs with RustEmbed. WASM load fetches icons/*.svg with reqwest from a caller-supplied endpoint.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was stale
crates/moon-ui-components-assets/README.mdstill called this crate the default asset bundle for Longbridge GPUI Component. The crate docs said WASM icons are downloaded from a CDN withweb_sys::Request, and linkedIconNameat docs.rs for the upstreamgpui-componentcrate.What the code does
The package is
moon-ui-components-assets(Rust librarygpui_component_assets; the workspace depends on it asgpui-component-assets).moon-uire-exportsAssetsasMoonAssets.build.rspublishesassets/iconsthrough the Cargolinkskeygpui-component-default-icons, andmoon-ui-componentsgeneratesIconNamefromDEP_GPUI_COMPONENT_DEFAULT_ICONS_ICONS_DIR.Native
Assetsembedsassets/icons/**/*.svgwith RustEmbed. It is a unit struct, andAssets::newignores its endpoint. On wasm,Assets::newonly stores the endpoint.loadfetches a path withreqwestfrom{endpoint}/assets/{path}when the path starts withicons/and ends with.svg, and caches the bytes. Until that download finishes,loadreturns an error. The sprite atlas does not store that failure, so a later paint callsloadagain.Review
A clean-context pass disputed one README sentence that said
Assets::new(endpoint)performs the download.Assets::newonly stores the endpoint (wasm_assets.rs). That sentence now attributes the download toload. Nothing else was disputed, and the disputed wording was not left in the diff.How verified
Checked against
native_assets.rs,wasm_assets.rs, bothbuild.rsfiles,icon.rs,paint_svg,render_alpha_mask, andPlatformAtlas::get_or_insert_withon the DirectX, Metal, and wgpu atlases.cargo fmt --allchanged no other files. The example isrust,no_run, and this crate setsdoctest = false.