pub struct FlashRuntime<'a>(/* private fields */);Expand description
The primary entry point of this crate, providing access to its public APIs.
Implementations§
Source§impl<'a> FlashRuntime<'a>
impl<'a> FlashRuntime<'a>
pub fn current_context(&self) -> Context<'a>
pub fn event_dispatcher(&self) -> EventDispatcher
Sourcepub unsafe fn with<F, R>(ctx: &'a FREContext, f: F) -> Rwhere
F: FnOnce(&FlashRuntime<'a>) -> R,
R: 'a,
pub unsafe fn with<F, R>(ctx: &'a FREContext, f: F) -> Rwhere
F: FnOnce(&FlashRuntime<'a>) -> R,
R: 'a,
A wrapper used by FREContextInitializer, FREContextFinalizer, and
FREFunction that provides a safe stack-level execution environment.
In typical usage of this crate, this function should not be called directly.
§Safety
While all operations performed within this function are safe at the stack level, calling this function itself is unsafe and requires that all input arguments are valid. In particular, this function assumes it is invoked directly with arguments provided by the Flash runtime.
Violating these assumptions may lead to undefined behavior.
Sourcepub unsafe fn with_context_initializer<F>(
ext_data: FREData,
ctx_type: FREStr,
ctx: &'a FREContext,
num_funcs_to_set: *mut u32,
funcs_to_set: *mut *const FRENamedFunction,
f: F,
)
pub unsafe fn with_context_initializer<F>( ext_data: FREData, ctx_type: FREStr, ctx: &'a FREContext, num_funcs_to_set: *mut u32, funcs_to_set: *mut *const FRENamedFunction, f: F, )
A wrapper around FREContextInitializer that provides a safe stack-level
execution environment for context initialization.
In typical usage of this crate, this function should not be called directly.
§Safety
While all operations performed within this function are safe at the stack level, calling this function itself is unsafe and requires the following conditions:
- The native data associated with
Contextmust not be accessed or managed by external code. - This function will construct a
ContextRegistryand assign it as the native data. The constructedContextRegistrymust be properly disposed inFREContextFinalizerto ensure its lifecycle is correctly terminated. - This function assumes it is invoked directly with arguments provided by the Flash runtime, meaning all arguments must be valid and consistent.
Violating these assumptions may lead to undefined behavior.
Sourcepub unsafe fn with_method<F>(
ctx: &'a FREContext,
func_data: FREData,
argc: u32,
argv: *const FREObject,
f: F,
) -> FREObject
pub unsafe fn with_method<F>( ctx: &'a FREContext, func_data: FREData, argc: u32, argv: *const FREObject, f: F, ) -> FREObject
A wrapper around FREFunction that provides a safe stack-level execution
environment for the given closure.
In typical usage of this crate, this function should not be called directly.
§Safety
While all operations performed within this function are safe at the stack level, calling this function itself is unsafe and requires the following conditions:
func_datamust either be constructed viaData::into_rawbeforeContextInitializerreturns, or be a null pointer.- This function assumes it is invoked directly with arguments provided by the Flash runtime, meaning all arguments must be valid and consistent.
Violating these assumptions may lead to undefined behavior.