Skip to main content

markers_for_bin

Function markers_for_bin 

Source
pub fn markers_for_bin(
    bytes: &[u8],
) -> Result<BTreeSet<DataMarkerInfo>, DataError>
Expand description

Parses a compiled binary and returns a list of DataMarkerInfos that it uses at runtime.

This function is intended to be used for binaries that use BufferProvider, for which the compiler cannot remove unused data. Using this function on a binary that only uses compiled data (through the compiled_data feature or manual baked data) will not return any markers, as the markers only exist in the type system.

ยงExample

assert_eq!(
    icu::markers_for_bin(&std::fs::read(Path::new("target/release/my-app"))?)?,
    std::collections::BTreeSet::from_iter([
        icu::list::provider::ListAndV1::INFO,
        icu::list::provider::ListOrV1::INFO,
    ]),
);