HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
glassbearInc
rs-bindata
Rust2022–2022
glassbearInc / rs-bindata

rs-bindata

A stable channel rust macro to embed static assets into your binary at compile time.

2Distinct people
2Mentions
0Explicit recommenders
4GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A stable channel rust macro to embed static assets into your binary at compile time.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 5:04:57 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by hour2 dated mentions

Observed mentions: 2022-04-19 13:42:42 UTC to 2022-04-19 18:24:31 UTC.

012022-04-19 13:00:00 UTC to 2022-04-19 14:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsApr 19, 13:002022-04-19 14:00:00 UTC to 2022-04-19 15:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-04-19 15:00:00 UTC to 2022-04-19 16:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsApr 19, 15:002022-04-19 16:00:00 UTC to 2022-04-19 17:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-04-19 17:00:00 UTC to 2022-04-19 18:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-04-19 18:00:00 UTC to 2022-04-19 19:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsApr 19, 18:00

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Apr 19, 13:002022-04-19 13:00:00 UTC2022-04-19 14:00:00 UTC101
Apr 19, 14:002022-04-19 14:00:00 UTC2022-04-19 15:00:00 UTC000
Apr 19, 15:002022-04-19 15:00:00 UTC2022-04-19 16:00:00 UTC000
Apr 19, 16:002022-04-19 16:00:00 UTC2022-04-19 17:00:00 UTC000
Apr 19, 17:002022-04-19 17:00:00 UTC2022-04-19 18:00:00 UTC000
Apr 19, 18:002022-04-19 18:00:00 UTC2022-04-19 19:00:00 UTC101

What Hacker News says

2 sources
The bindata package that samhw linked goes further by walking a whole directory and embedding it all, supplying a function that maps from pathname to file contents. Looks like it returns an Option<Vec<u8>> though [1] which means it must be copying the file contents each time. I don't know why they didn't just return a &'static [u8] instead. There's another crate includedir which looks more popular. It also supports compression. But if the file is stored in compressed form, looks like it also will (decompress/)copy into a fresh Vec, whether you request the uncompressed or compressed forms. [2] That's not what I would like. I'd prefer (lazily or eagerly) decompressing once and keeping it around in RAM for next time. YMMV. I could use a high-quality implementation of this same idea. Personally I don't get using it for a personal blog (I'd ra
Read the rest
ther be able to change the content without recompiling/restarting), but on my todo list is producing a zero-dependency, single-binary form of software I'm working on, including its web interface. I might end up writing my own. [1] https://github.com/glassbearInc/rs-bindata/blob/93f61807b206... [2] lines 59 and 80, respectively. https://github.com/tilpner/includedir/blob/6a81c906e233649af...
In A blog that is a single executable binary
If you want to do something like this, I'd highly recommend using a package like rs-bindata[0] (Rust) or go-bindata[1] (Go) to essentially embed the static data into your .data section automatically, rather than having to paste it into constants. (Of course, writing it out manually in source code will do the very same - and that's all these packages do, albeit in the preprocessing phase - but this way is less clunky, and I suspect likely more performant and footgun-free than your own implementation is likely to be.) It's possible that you could even use this to enumerate all the files in some directory, such that you wouldn't require source code changes in order to add a new post - you'd simply need to run the preprocessor again in a different build environment. Also, in the spirit of the post: it should be relatively easy to implement th
Read the rest
is oneself with a build script in Rust. In Go I don't think it's as easy, and iirc the author of the package uses the semi-public 'build tags' API[2] (which always gave me a sense of being grudgingly released, in one of the countless "we core developers mustn't allow the unwashed hordes of lowly application developers to have these dangerous, powerful tools" fights that seem to characterise Go development). [0] https://github.com/glassbearInc/rs-bindata [1] https://github.com/jteeuwen/go-bindata [2] https://pkg.go.dev/go/build#hdr-Build_Constraints
In A blog that is a single executable binary

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.