Skip to main content

import

Function import 

Source
pub fn import(module: &str, prefix: &str) -> Result<Imported, LinkError>
Expand description

Takes the functions out of a module and renames its symbols with prefix.

Every function defined in the module, and every attribute or type alias defined next to it, is renamed to {prefix}_{name}. All functions become private, so that the linked module has only the caller’s main as its entry point. Attributes of the module itself are dropped.

§Errors

Returns an error if the text has no module, if its braces or string literals are unbalanced, or if it uses quoted symbol names.