Struct netcorehost::hostfxr::HostfxrContext [−][src]
pub struct HostfxrContext<I> { /* fields omitted */ }
Expand description
State which hostfxr creates and maintains and represents a logical operation on the hosting components.
Implementations
Creates a new context from the given handle.
Safety
The context handle has to be match the context type I
.
If the context was initialized using initialize_for_dotnet_command_line
I
has to be InitializedForCommandLine
.
If the context was initialized using initialize_for_runtime_config
I
has to be InitializedForRuntimeConfig
.
Gets the underlying handle to the hostfxr context.
Gets the underlying handle to the hostfxr context and consume this context.
pub fn get_runtime_property_value(
&self,
name: impl AsRef<PdCStr>
) -> Result<PdCString, HostingError>
pub fn get_runtime_property_value(
&self,
name: impl AsRef<PdCStr>
) -> Result<PdCString, HostingError>
Gets the runtime property value for the given key of this host context.
pub unsafe fn get_runtime_property_value_ref(
&self,
name: impl AsRef<PdCStr>
) -> Result<&PdCStr, HostingError>
pub unsafe fn get_runtime_property_value_ref(
&self,
name: impl AsRef<PdCStr>
) -> Result<&PdCStr, HostingError>
Gets the runtime property value for the given key of this host context.
Safety
The value string is owned by the host context. The lifetime of the buffer is only guaranteed until any of the below occur:
run_app
is called for this host context- properties are changed via
set_runtime_property_value
orremove_runtime_property_value
pub fn set_runtime_property_value(
&self,
name: impl AsRef<PdCStr>,
value: impl AsRef<PdCStr>
) -> Result<HostingSuccess, HostingError>
pub fn set_runtime_property_value(
&self,
name: impl AsRef<PdCStr>,
value: impl AsRef<PdCStr>
) -> Result<HostingSuccess, HostingError>
Sets the value of a runtime property for this host context.
pub fn remove_runtime_property_value(
&self,
name: impl AsRef<PdCStr>
) -> Result<HostingSuccess, HostingError>
pub fn remove_runtime_property_value(
&self,
name: impl AsRef<PdCStr>
) -> Result<HostingSuccess, HostingError>
Remove a runtime property for this host context.
pub unsafe fn get_runtime_properties_ref(
&self
) -> Result<(Vec<&PdCStr>, Vec<&PdCStr>), HostingError>
pub unsafe fn get_runtime_properties_ref(
&self
) -> Result<(Vec<&PdCStr>, Vec<&PdCStr>), HostingError>
Get all runtime properties for this host context.
Safety
The strings returned are owned by the host context. The lifetime of the buffers is only guaranteed until any of the below occur:
run_app
is called for this host context- properties are changed via
set_runtime_property_value
orremove_runtime_property_value
- the host context is dropped
pub fn get_runtime_properties_owned(
&self
) -> Result<(Vec<PdCString>, Vec<PdCString>), HostingError>
pub fn get_runtime_properties_owned(
&self
) -> Result<(Vec<PdCString>, Vec<PdCString>), HostingError>
Get all runtime properties for this host context as owned strings.
pub unsafe fn get_runtime_properties_ref_iter(
&self
) -> Result<impl Iterator<Item = (&PdCStr, &PdCStr)>, HostingError>
pub unsafe fn get_runtime_properties_ref_iter(
&self
) -> Result<impl Iterator<Item = (&PdCStr, &PdCStr)>, HostingError>
Get all runtime properties for this host context as an iterator over borrowed key-value pairs.
Safety
The strings returned are owned by the host context. The lifetime of the buffers is only guaranteed until any of the below occur:
run_app
is called for this host context- properties are changed via
set_runtime_property_value
orremove_runtime_property_value
- the host context is dropped
pub fn get_runtime_properties_iter(
&self
) -> Result<impl Iterator<Item = (PdCString, PdCString)>, HostingError>
pub fn get_runtime_properties_iter(
&self
) -> Result<impl Iterator<Item = (PdCString, PdCString)>, HostingError>
Get all runtime properties for this host context as an iterator over owned key-value pairs.
pub unsafe fn get_runtime_properties_ref_as_map(
&self
) -> Result<HashMap<&PdCStr, &PdCStr>, HostingError>
pub unsafe fn get_runtime_properties_ref_as_map(
&self
) -> Result<HashMap<&PdCStr, &PdCStr>, HostingError>
Get all runtime properties for this host context as an hashmap of borrowed strings.
Safety
The strings returned are owned by the host context. The lifetime of the buffers is only guaranteed until any of the below occur:
run_app
is called for this host context- properties are changed via
set_runtime_property_value
orremove_runtime_property_value
- the host context is dropped
pub fn get_runtime_properties_as_map(
&self
) -> Result<HashMap<PdCString, PdCString>, HostingError>
pub fn get_runtime_properties_as_map(
&self
) -> Result<HashMap<PdCString, PdCString>, HostingError>
Get all runtime properties for this host context as an hashmap of owned strings.
pub fn get_runtime_delegate(
&self,
type: hostfxr_delegate_type
) -> Result<MethodWithUnknownSignature, HostingError>
pub fn get_runtime_delegate(
&self,
type: hostfxr_delegate_type
) -> Result<MethodWithUnknownSignature, HostingError>
Gets a typed delegate from the currently loaded CoreCLR
or from a newly created one.
You propably want to use get_delegate_loader
or get_delegate_loader_for_assembly
instead of this function if you want to load function pointers.
Remarks
If the context was initialized using initialize_for_runtime_config
, then all delegate types are supported.
If it was initialized using initialize_for_dotnet_command_line
, then only the following
delegate types are currently supported:
Gets a delegate loader for loading an assembly and contained function pointers.
pub fn get_delegate_loader_for_assembly<A: AsRef<PdCStr>>(
&self,
assembly_path: A
) -> Result<AssemblyDelegateLoader<'_, A>, HostingError>
pub fn get_delegate_loader_for_assembly<A: AsRef<PdCStr>>(
&self,
assembly_path: A
) -> Result<AssemblyDelegateLoader<'_, A>, HostingError>
Gets a delegate loader for loading function pointers of the assembly with the given path. The assembly will be loaded lazily when the first function pointer is loaded.
Closes an initialized host context.
This method is automatically called on drop, but can be explicitely called to handle errors during closing.
Load the dotnet runtime and run the application.
Return value
If the app was successfully run, the exit code of the application. Otherwise, the error code result.
Trait Implementations
Consume self without dropping it while dropping all of its contents normally.