Skip to main content

Module dylib

Module dylib 

Source
Expand description

Build-and-cache helpers for plugin cdylib fixtures.

Integration tests frequently need to invoke cargo build on a plugin crate, locate the produced .dylib/.so/.dll, and point a PluginHost at its containing directory. Doing this from scratch in every test is noisy and slow — each test re-builds the plugin even though the source hasn’t changed.

dylib_fixture returns a process-wide cached build result: the first call builds the plugin; subsequent calls in the same test binary return the existing path without re-running cargo. Fresh cargo test invocations still rebuild (on cache miss in cargo’s own target dir).

§Example

let fixture = dylib_fixture("./path/to/my-plugin").build();
let host = PluginHost::builder()
    .search_path(fixture.dir())
    .build()?;

Structs§

DylibFixture
A built plugin ready to be loaded by a PluginHost.
DylibFixtureBuilder
Builder for DylibFixture. See dylib_fixture.

Functions§

dylib_fixture
Start building a dylib fixture for the plugin crate at plugin_dir.