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

A struct for loading pointers to managed functions for a given HostfxrContext.

Implementations§

source§

impl DelegateLoader

source

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

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. Once loaded it will find the specified type and method and return a native function pointer to that method.

§Arguments
  • assembly_path: Path to the assembly to load. In case of complex component, this should be the main assembly of the component (the one with the .deps.json next to it). Note that this does not have to be the assembly from which the type_name and method_name are.
  • 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 load_assembly_and_get_function_with_default_signature( &self, assembly_path: &PdCStr, type_name: &PdCStr, method_name: &PdCStr ) -> Result<ManagedFunctionWithDefaultSignature, GetManagedFunctionError>

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. Once loaded it will find the specified type and method and return a native function pointer to that method.

§Arguments
  • assembly_path: Path to the assembly to load. In case of complex component, this should be the main assembly of the component (the one with the .deps.json next to it). Note that this does not have to be the assembly from which the type_name and method_name are.
  • 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 load_assembly_and_get_function_with_unmanaged_callers_only<F: FunctionPtr>( &self, assembly_path: &PdCStr, type_name: &PdCStr, method_name: &PdCStr ) -> Result<ManagedFunction<F::Managed>, GetManagedFunctionError>

Available on crate feature net5_0 only.

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. Once loaded it will find the specified type and method and return a native function pointer to that method. The target method has to be annotated with the UnmanagedCallersOnlyAttribute.

§Arguments
  • assembly_path: Path to the assembly to load. In case of complex component, this should be the main assembly of the component (the one with the .deps.json next to it). Note that this does not have to be the assembly from which the type_name and method_name are.
  • 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\]].
source

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

Available on crate feature net5_0 only.

Calling this function will find the specified type and method and return a native function pointer to that method. This will NOT load the containing assembly.

§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>

Calling this function will find the specified type and method and return a native function pointer to that method. This will NOT load the containing assembly.

§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.

Calling this function will find the specified type and method and return a native function pointer to that method. This will NOT load the containing assembly.

§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 DelegateLoader

source§

fn clone(&self) -> Self

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.