Skip to main content

FlashRuntime

Struct FlashRuntime 

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

Source

pub fn current_context(&self) -> Context<'a>

Source

pub fn event_dispatcher(&self) -> EventDispatcher

Source

pub unsafe fn with<F, R>(ctx: &'a FREContext, f: F) -> R
where 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.

Source

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, )
where F: FnOnce(&FlashRuntime<'a>) -> FunctionSet,

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 Context must not be accessed or managed by external code.
  • This function will construct a ContextRegistry and assign it as the native data. The constructed ContextRegistry must be properly disposed in FREContextFinalizer to 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.

Source

pub unsafe fn with_method<F>( ctx: &'a FREContext, func_data: FREData, argc: u32, argv: *const FREObject, f: F, ) -> FREObject
where F: FnOnce(&FlashRuntime<'a>, Option<&mut dyn Any>, &[Object<'a>]) -> Object<'a>,

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_data must either be constructed via Data::into_raw before ContextInitializer returns, 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.

Source

pub fn trace(&self, msg: impl Into<UCStr>)

Trait Implementations§

Source§

impl<'a> Debug for FlashRuntime<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for FlashRuntime<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for FlashRuntime<'a>

§

impl<'a> RefUnwindSafe for FlashRuntime<'a>

§

impl<'a> !Send for FlashRuntime<'a>

§

impl<'a> !Sync for FlashRuntime<'a>

§

impl<'a> Unpin for FlashRuntime<'a>

§

impl<'a> UnsafeUnpin for FlashRuntime<'a>

§

impl<'a> UnwindSafe for FlashRuntime<'a>

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

Source§

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.