Okay. Time for everyone's favorite type of programming discussion: *Naming*.

So: I am interested in a particular way of using Rust where you have a single programming interface, and when executed in wasm it uses browser APIs and when executed on desktop it uses some native crate. (I care more about saving space on wasm than desktop.)

What general word or name do you think I should use to describe this type of wrapper api, if I start exporting implementations of such interfaces as a crates?

So for example, I have the bytes of a PNG or JPEG file, and I am writing a function that can convert those bytes to RGBA bytes (or rather an Image crate DynamicImage). I intend to put this function in a crate. A second crate that would also make sense would be converting PNG bytes into a WGPU texture (which on web can be done directly).

I could name the second wgpu-load-image, but maybe it would make sense to have the crate name have some word prefix in common with the bytes one.

Separately, this crate exists: github.com/orottier/web-audio- it implements the functionality of WebAudio in a native crate. But it doesn't have the same interface as wasm-bindgen WebAudio. What if I want to write code that can work on native *or* wasm?

When I asked them about this, they concluded the most logical thing would be to create a third crate which exports one interface and reduces to either web-audio-api-rs or wasm-bindgen WebAudio depending on where you run it.

So if I can pick some word prefix for my two "browser, maybe" crates, I could possibly use the same prefix for my "WebAudio, maybe" crate. I can't think what that word would be. My image decoder is currently named FlexDecoder but that's a frustratingly vague name.

At one time I was thinking that if you could bundle together a *bunch* of crates like this into a Platform– like, wgpu crate, plus that web-audio-api-rs crate, plus a embeddable JavaScript engine to run on desktop, plus some other little bits of glue– you could call it "Neutrino". Because It's like Electron, but very very lightweight, barely there at all really

Okay, poll time, cuz I'm doing this

What vocabulary/tag/branding should I use in the name/README of my Rust modules to indicate "this uses the browser to do it if the browser is available, and substitutes a native polyfill otherwise"?

So like for example I'd name the package "iso-image-to-gpu" for option 1, "amph-image-to-gpu" for option 2, and just "image-to-gpu" for the fourth option.

I'm making 3 modules so I want to do something to make it clear they share this same property.

Follow

@mcc I voted amphibious mostly because amphibians are cool

Sign in to participate in the conversation
Mastodon

General topic personal server.