pub struct DynamicallyLinkedFileExtPlugin {
pub handle: ManuallyDrop<Box<dyn FileExtPlugin>>,
pub library: ManuallyDrop<Library>,
}Expand description
This struct represents a dynamically linked Plugin.
It loads the plugin from a shared library at runtime, storing the handle as a Box<dyn FileExtPlugin>.
It’s really important to store the library as well, because once the library is dropped the handle will be invalid.
While for the Node struct we don’t care about the order of the library and the handle, because by design the node will be dropped
before the library, it’s not the case here. And so we need either to use ManuallyDrop or to order the fields in a way that the library is dropped last.
Fields§
§handle: ManuallyDrop<Box<dyn FileExtPlugin>>§library: ManuallyDrop<Library>Implementations§
Source§impl DynamicallyLinkedFileExtPlugin
impl DynamicallyLinkedFileExtPlugin
Sourcepub fn new(
handle: Box<dyn FileExtPlugin>,
library: Library,
) -> DynamicallyLinkedFileExtPlugin
pub fn new( handle: Box<dyn FileExtPlugin>, library: Library, ) -> DynamicallyLinkedFileExtPlugin
Create a new DynamicallyLinkedFileExtPlugin with the given handle and library.
Use this function to make it easier to create a new DynamicallyLinkedFileExtPlugin.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DynamicallyLinkedFileExtPlugin
impl !RefUnwindSafe for DynamicallyLinkedFileExtPlugin
impl Send for DynamicallyLinkedFileExtPlugin
impl Sync for DynamicallyLinkedFileExtPlugin
impl Unpin for DynamicallyLinkedFileExtPlugin
impl !UnwindSafe for DynamicallyLinkedFileExtPlugin
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