Is it possible to populate a large set at compile time?

后端 未结 3 671
-上瘾入骨i
-上瘾入骨i 2020-12-20 19:56

We have a \'delete all my data\' feature. I\'d like to delete a set of IPs from many many web log files.

Currently at runtime I open a CSV with the IP addresses to d

3条回答
  •  清歌不尽
    2020-12-20 20:21

    The Rust-PHF crate provides compile-time data structures, including (ordered) maps and sets.

    Unfortunately, to date, it does not support initialization of a set of std::net::IpAddr, but can be used with static strings:

    static IP_SET: phf::Set<&'static str> = phf_set! {
        "127.0.0.1",
        "::1",
    };
    

提交回复
热议问题