pub struct AssemblyDelegateLoader { /* private fields */ }
Available on crate feature netcore3_0 only.
Expand description

A struct for loading pointers to managed functions for a given HostfxrContext which automatically loads the assembly from the given path on the first access.

Implementations§

source§

impl AssemblyDelegateLoader

source

pub fn new(loader: DelegateLoader, assembly_path: impl Into<PdCString>) -> Self

Creates a new AssemblyDelegateLoader wrapping the given DelegateLoader loading the assembly from the given path on the first access.

source

pub fn get_function<F: FunctionPtr>( &self, type_name: &PdCStr, method_name: &PdCStr, delegate_type_name: &PdCStr ) -> Result<ManagedFunction<F::Managed>, GetManagedFunctionError>

If this is the first loaded function pointer, calling this function will load the specified assembly in isolation (into its own AssemblyLoadContext) and it will use AssemblyDependencyResolver on it to provide dependency resolution. Otherwise or once loaded it will find the specified type and method and return a native function pointer to that method. Calling this function will find the specified type and method and return a native function pointer to that method.

§Arguments
  • type_name: Assembly qualified type name to find
  • method_name: Name of the method on the type_name to find. The method must be static and must match the signature of delegate_type_name.
  • delegate_type_name: Assembly qualified delegate type name for the method signature.
source

pub fn get_function_with_default_signature( &self, type_name: &PdCStr, method_name: &PdCStr ) -> Result<ManagedFunctionWithDefaultSignature, GetManagedFunctionError>

If this is the first loaded function pointer, calling this function will load the specified assembly in isolation (into its own AssemblyLoadContext) and it will use AssemblyDependencyResolver on it to provide dependency resolution. Otherwise or once loaded it will find the specified type and method and return a native function pointer to that method. Calling this function will find the specified type and method and return a native function pointer to that method.

§Arguments
  • type_name: Assembly qualified type name to find
  • method_name: Name of the method on the type_name to find. The method must be static and must match the following signature: public delegate int ComponentEntryPoint(IntPtr args, int sizeBytes);
source

pub fn get_function_with_unmanaged_callers_only<F: FunctionPtr>( &self, type_name: &PdCStr, method_name: &PdCStr ) -> Result<ManagedFunction<F::Managed>, GetManagedFunctionError>

Available on crate feature net5_0 only.

If this is the first loaded function pointer, calling this function will load the specified assembly in isolation (into its own AssemblyLoadContext) and it will use AssemblyDependencyResolver on it to provide dependency resolution. Otherwise or once loaded it will find the specified type and method and return a native function pointer to that method. Calling this function will find the specified type and method and return a native function pointer to that method.

§Arguments
  • type_name: Assembly qualified type name to find
  • method_name: Name of the method on the type_name to find. The method must be static and must match be annotated with UnmanagedCallersOnly.

Trait Implementations§

source§

impl Clone for AssemblyDelegateLoader

source§

fn clone(&self) -> AssemblyDelegateLoader

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.