-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Derive the import namespace from the provider module (#786)
- Loading branch information
1 parent
1ffa0a7
commit 4a7f0ad
Showing
4 changed files
with
48 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Create a custom section named `import_namespace` with the contents of the | ||
// string argument. | ||
macro_rules! import_namespace { | ||
($str:literal) => { | ||
const IMPORT_NAMESPACE_BYTES: &[u8] = $str.as_bytes(); | ||
|
||
#[link_section = "import_namespace"] | ||
pub static IMPORT_NAMESPACE: [u8; IMPORT_NAMESPACE_BYTES.len()] = { | ||
let mut arr = [0u8; IMPORT_NAMESPACE_BYTES.len()]; | ||
let mut i = 0; | ||
while i < IMPORT_NAMESPACE_BYTES.len() { | ||
arr[i] = IMPORT_NAMESPACE_BYTES[i]; | ||
i += 1; | ||
} | ||
arr | ||
}; | ||
}; | ||
} | ||
|
||
pub(crate) use import_namespace; |