Name for a small utility crate

I have been annoyed that I have to re-implement the offset_of! macro in each of my projects. Because apparently nobody made a crate for it yet, I decided to remedy that.

The tiny crate that I made contains not only offset_of! macro but also size_of! and align_of!. Why? Because of aesthetics: having offset_of! and size_of! next to each other occur as macro is way prettier than the case where one of them is a macro and the other one is not. Controversial, I know!

We all know that naming things is hard. While with more sophisticated libraries one can be clever and creative with names, for crates with small utility functions it seems inappropriate.

So, the question to you, dear Rust community, is obvious: how should I name the crate? So far I have used bytes_of because it mirrors the *_of pattern used by implemented macros. Other candidates I have came up with include: typecalc or memcalc or memlayout or bytelay or...

I should also note that I generally dislike names with underscores in them - they break my aesthetics, something I value far too much.

Any nice propositions? Or other thoughts? Maybe I should not pollute Cargo index with such tiny crate? Maybe having align_of and size_of redefined as macros is a very bad thing and does more harm than good?

Thanks!

If you don't mind a strange---but short and easy-to-remember-once-seen---name, how about a poof (short for "the position and offset of fields")? It even ends with of :smiley:

(Oh, by the way you can add function names to the keywords list in Cargo.toml for the better discoverability.)

1 Like

Well, I certainly do not mind, but as I mentioned in my first post, I was wondering whether being clever with names for such small utility crate is appropriate. But maybe it isn't bad idea.

I like the sound of poof (and it being ended with of!) but I am not sure about the position part of it. But inspired by your proposition I came up with masom (short for memory alignment, size and offset macros) or just asom (dropping the memory part). Any thoughts?

2 Likes

+1 for masom

1 Like

To go boring and simple: "layouttools" or "structtools". This fits with things like "cputools" or "itertools". Small crates providing useful functionality in a limited scope.

I also like "asom", because it can be read like "a-some"->"awesome"

Or memtools, since it is heavily connected to std::mem.

As I mentioned I my first entry, I am in favor of using boring and simple names for small utility crates. While I like the sound of asom and alike, stealing that name for such a small crate feels unfair.

I don't know, maybe I am overthinking all of this but picking right name, even for small stuff, is very important for me. The most frightening part is that once a name is chosen, it cannot be given back to the community. It stays bound to a particular code for all eternity. Terrifying!

I know of itertools but I cannot find anything on cputools (neither on crates.io, nor GitHub). Is this a real crate?

Well, not directly. Retep998 had this problem with the literally hundreds of names he reserved for the windows API, before he consolidated under the single winapi crate.
All those abandoned names now simply say "if you want this name, contact me so we can discuss transferring it"

Apparently not! I thought it was an existing python library, but I seem to have confused myself with classtools

Go for it! You are an early adopter, trying to make the early wild west of the Rust ecosystem a little better! That deserves recognition, so pick whatever name you like!
There's even precedent with request (4k downloads) Vs reqwest (76k)