pub trait Context<'a>: Sealed {
// Required methods
fn as_handle(&self) -> NonNull<c_void>;
fn is_valid(&self) -> bool;
// Provided methods
fn as_ptr(&self) -> FREContext { ... }
fn trace<T: ToUcstrLossy + Sized>(&self, message: T) { ... }
fn event_dispatcher(&self) -> EventDispatcher { ... }
fn get_render_mode(&self, stage: Option<Stage<'a>>) -> RenderMode { ... }
fn set_render_source(
&self,
source: MediaBuffer<'a>,
display_object: NonNullObject<'a>,
) -> Result<(), FfiError> { ... }
fn with_media_buffer<F, R>(&self, media_buffer: MediaBuffer<'a>, f: F) -> R
where F: FnOnce(MediaBufferDataAdapter<'_>) -> R { ... }
}Required Methods§
fn as_handle(&self) -> NonNull<c_void>
Sourcefn is_valid(&self) -> bool
fn is_valid(&self) -> bool
Returns whether the context is valid.
The context remains valid until FREContextFinalizer has completed.
Invalidity only occurs when the associated ExtensionContext object
is destructed or its dispose method is explicitly called.
Provided Methods§
fn as_ptr(&self) -> FREContext
Sourcefn trace<T: ToUcstrLossy + Sized>(&self, message: T)
fn trace<T: ToUcstrLossy + Sized>(&self, message: T)
Sends a message to the debugger output.
Delivery is not guaranteed; the message may not be presented.
§Examples
use fre_rs::prelude::*;
fn func <'a> (ctx: &mut CurrentContext<'a>, args: &[Object<'a>]) {
ctx.trace("Hello, Flash runtime!");
ctx.trace(args);
ctx.trace(args[0]);
}Sourcefn event_dispatcher(&self) -> EventDispatcher
fn event_dispatcher(&self) -> EventDispatcher
Returns an EventDispatcher used to perform asynchronous callbacks
via the AS3 event system.
Sourcefn get_render_mode(&self, stage: Option<Stage<'a>>) -> RenderMode
fn get_render_mode(&self, stage: Option<Stage<'a>>) -> RenderMode
Returns the render mode of the stage.
If stage is None, the main/initial stage is used.
Sourcefn set_render_source(
&self,
source: MediaBuffer<'a>,
display_object: NonNullObject<'a>,
) -> Result<(), FfiError>
fn set_render_source( &self, source: MediaBuffer<'a>, display_object: NonNullObject<'a>, ) -> Result<(), FfiError>
Returns Err if display_object has an incorrect type.
Sourcefn with_media_buffer<F, R>(&self, media_buffer: MediaBuffer<'a>, f: F) -> Rwhere
F: FnOnce(MediaBufferDataAdapter<'_>) -> R,
fn with_media_buffer<F, R>(&self, media_buffer: MediaBuffer<'a>, f: F) -> Rwhere
F: FnOnce(MediaBufferDataAdapter<'_>) -> R,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.