pub trait Lib {
// Required methods
fn manifest(&self) -> LibManifest;
fn load(&self, cx: &mut LoadCx, linker: &mut Linker<'_>) -> Result<()>;
// Provided method
fn unload(&self, _cx: &mut Cx, _linker: &mut Linker<'_>) -> Result<()> { ... }
}Expand description
The contract every loadable library implements.
A library presents its LibManifest and wires its behavior into the
registry through a Linker during load. The kernel defines
this contract; libraries provide the behavior.
Required Methods§
Sourcefn manifest(&self) -> LibManifest
fn manifest(&self) -> LibManifest
Returns the library’s manifest.
Provided Methods§
Sourcefn unload(&self, _cx: &mut Cx, _linker: &mut Linker<'_>) -> Result<()>
fn unload(&self, _cx: &mut Cx, _linker: &mut Linker<'_>) -> Result<()>
Tears down external resources that cannot be represented in the registry’s recorded load delta.
Normal export removal is driven by Registry::unload, which retracts
the committed registry records for a loaded LibId.
Libraries should only override this hook when they acquire external
resources outside the registry receipt; the default means there is no
custom external teardown.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".