Skip to main content

Context

Trait Context 

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

Source

fn as_handle(&self) -> NonNull<c_void>

Source

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§

Source

fn as_ptr(&self) -> FREContext

Source

fn event_dispatcher(&self) -> EventDispatcher

Returns an EventDispatcher used to perform asynchronous callbacks via the ActionScript event system.

Source

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.

Source

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.

Source

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.

Source

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.

Implementors§