pub enum LinkKind {
Default,
Static,
WholeArchive,
}Expand description
Represents how a library should be linked.
The link kind determines what cargo metadata directive is emitted:
Default→cargo:rustc-link-lib=nameStatic→cargo:rustc-link-lib=static:[-bundle]=nameWholeArchive→cargo:rustc-link-lib=static:+whole-archive[,-bundle]=name
Variants§
Default
Let the linker decide (typically finds .so first, then .a).
Used for system libraries like pthread, numa, lz4 where the
.a file either doesn’t exist or is in a system directory.
Static
Static library without +whole-archive.
Used for libraries where a .a file exists in a non-system directory,
but constructor functions don’t need to be preserved.
WholeArchive
Static library with +whole-archive.
Required for libraries using constructor functions (e.g., DPDK’s RTE_INIT
macros) to ensure all symbols are included even if not directly referenced.
Without this, the linker would discard “unused” constructor symbols.
Trait Implementations§
impl Copy for LinkKind
impl Eq for LinkKind
impl StructuralPartialEq for LinkKind
Auto Trait Implementations§
impl Freeze for LinkKind
impl RefUnwindSafe for LinkKind
impl Send for LinkKind
impl Sync for LinkKind
impl Unpin for LinkKind
impl UnwindSafe for LinkKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more