Skip to main content

Module static_init

Module static_init 

Source
Expand description

Static init blocks: code that runs when the program or library that holds it loads. The blocks of a program or library are gathered at link time, wherever in it they are, and a constructor runs them when it loads. Once Python loads a library built on this crate, by any means, it sees what the blocks registered, such as global functions. A block that several libraries of a process have, as each links its own copy of a crate they share, runs once. See static_init_block!.

Functionsยง

run_static_init_blocks
Run every static_init_block! of this program or library that has not run, in the order of their modules and lines; running again does nothing. Every block is tried, and the error lists those that failed. A block that another library of the process has run, from the same version of its crate and the same text, is skipped: libraries that link the same crate register what its blocks define once.