Skip to content

Commit 702aa29

Browse files
committed
Make metadata extraction functions pub
In #2640 I speculated that maybe external bindings would want to roll their own metadata-extraction functions. I'm not sure if it'll work for that case, but it seems like a good thing in general. Making these functions `pub` is a step in that direction. I could see external bindings code try their specialized `extract_from_foo` function first, then fallback to calling `extract_from_bytes` to see if one of the standard cases works.
1 parent 8c56666 commit 702aa29

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

uniffi_bindgen/src/macro_metadata/extract.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn extract_from_library(path: &Utf8Path) -> anyhow::Result<Vec<Metadata>> {
2424
extract_from_bytes(&fs::read(path)?)
2525
}
2626

27-
fn extract_from_bytes(file_data: &[u8]) -> anyhow::Result<Vec<Metadata>> {
27+
pub fn extract_from_bytes(file_data: &[u8]) -> anyhow::Result<Vec<Metadata>> {
2828
match Object::parse(file_data)? {
2929
Object::Elf(elf) => extract_from_elf(elf, file_data),
3030
Object::PE(pe) => extract_from_pe(pe, file_data),
@@ -271,7 +271,7 @@ impl ExtractedItems {
271271
}
272272
}
273273

274-
fn is_metadata_symbol(name: &str) -> bool {
274+
pub fn is_metadata_symbol(name: &str) -> bool {
275275
// Skip the "_" char that Darwin prepends, if present
276276
let name = name.strip_prefix('_').unwrap_or(name);
277277
name.starts_with("UNIFFI_META")

0 commit comments

Comments
 (0)