Why "bring your own allocator" APIs are not more popular in Rust?

In my case, and since you picked on regex here (:P), I think it is actually exactly the point. In general, I view putting an allocator in the public API as a complication of the public API. That complication needs to either be worth it or it needs to not be a complication. In Zig land, I think it would "not be a complication," because the entire ecosystem is built around a custom allocator design. So I think this probably mirrors the "nobody does it because std doesn't do it" explanation that others have given.

As for whether it would be worth it... It's legitimately unclear to me who exactly would use regex if it had a custom allocator API that is otherwise not using it today. I think that goes for a lot of my libraries. The "custom allocator" use cases are things I am very ignorant of, because I don't tend to work in that space. And because Rust doesn't have great support for custom allocators, I think we are probably not seeing at least some set of folks that consider such a thing table steaks. So there's a negative feedback loop here, probably. And I don't know how to measure it.

24 Likes