pub trait Context: Sealed {
// Required methods
fn as_handle(&self) -> NonNull<c_void>;
fn is_valid(&self) -> bool;
// Provided methods
fn as_ptr(&self) -> FREContext { ... }
fn event_dispatcher(&self) -> EventDispatcher { ... }
fn trace(&self, message: impl ToUcstrLossy) { ... }
fn get_render_mode(
&self,
stage: Option<Object<'_>>,
) -> Result<RenderMode, FfiError> { ... }
fn set_render_source(
&self,
media_buffer: Object<'_>,
sprite: Object<'_>,
) -> Result<(), FfiError> { ... }
fn with_media_buffer<F, R>(
&self,
media_buffer: Object<'_>,
f: F,
) -> Result<R, FfiError>
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 event_dispatcher(&self) -> EventDispatcher
fn event_dispatcher(&self) -> EventDispatcher
Returns an EventDispatcher used to perform asynchronous callbacks
via the ActionScript event system.
Sourcefn trace(&self, message: impl ToUcstrLossy)
fn trace(&self, message: impl ToUcstrLossy)
Sends a message to the debugger output.
Delivery is not guaranteed; the message may not be presented.
message can be an as3::Object or a slice of it.
Sourcefn get_render_mode(
&self,
stage: Option<Object<'_>>,
) -> Result<RenderMode, FfiError>
fn get_render_mode( &self, stage: Option<Object<'_>>, ) -> Result<RenderMode, FfiError>
Return Err if stage is non-null but not a Stage object
This is a minimal safety wrapper around the underlying FFI. Its current placement, shape, and usage are not ideal, and it is expected to be refactored if the ANE C API allows more precise determination of an object’s concrete type.
Sourcefn set_render_source(
&self,
media_buffer: Object<'_>,
sprite: Object<'_>,
) -> Result<(), FfiError>
fn set_render_source( &self, media_buffer: Object<'_>, sprite: Object<'_>, ) -> Result<(), FfiError>
air.media.MediaBuffer (AIR SDK 51)
AIR-5963: Add ANE capabilities to render a Sprite using a MediaBuffer - initial support via BitmapData
This is a minimal safety wrapper around the underlying FFI. Its current placement, shape, and usage are not ideal, and it is expected to be refactored if the ANE C API allows more precise determination of an object’s concrete type.
Sourcefn with_media_buffer<F, R>(
&self,
media_buffer: Object<'_>,
f: F,
) -> Result<R, FfiError>where
F: FnOnce(MediaBufferDataAdapter<'_>) -> R,
fn with_media_buffer<F, R>(
&self,
media_buffer: Object<'_>,
f: F,
) -> Result<R, FfiError>where
F: FnOnce(MediaBufferDataAdapter<'_>) -> R,
This is a minimal safety wrapper around the underlying FFI. Its current placement, shape, and usage are not ideal, and it is expected to be refactored if the ANE C API allows more precise determination of an object’s concrete type.
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.