fst
fst copied to clipboard
no_std support
This PR adds two feature flags std
and alloc
(both of which are enabled by default) allowing this crate to be used in no_std contexts such as embedded (or wasm if you want to optimize the file size really aggressively like me).
This works because the basic fst query operations such as get
and contains
actually do not allocate at all and building the actual fst can be done in a build script in most situations.
std
only really enables features that depend on io::Write
while most of the fst functions (all construction and complex query types) are gated behind alloc
I made this change mostly for myself, but thought I might as well volunteer it for inclusion even though the macros and conditional includes do complicate the codebase a fair bit I think it's a neat addition.
Edit: Ah and full no_std
mode needs nightly, bc of error in core, which shouldn't be a problem in practice since most no_std users are on nightly anyway, but I'm happy to rip that out