Crate ppapiExperimental[stability] [-]  [+] [src]

Rust idiomatic wrapper for the Pepper API.

To use, you will need to implement at least these two functions:

#![no_main]
#[no_managle]
pub extern fn ppapi_instance_created(instance: Instance,
                                     args: HashMap<String, String>) {
}
#[no_managle]
pub extern fn ppapi_instance_destroyed() {
}

All instances will be created from a new task/thread. The task takes its name from the id attribute on the embed object used to create the instance. Failing will cause rust-ppapi to cleanup the task, though the plugin will continue to run. Currently there is no way to automatically restart an instance if it fails.

The other callbacks consist of:

#[no_mangle]
pub extern fn ppapi_on_document_loaded(loader: ppapi::UrlLoader) -> bool {
}
#[no_mangle]
pub extern fn ppapi_on_change_view(view: ppapi::View) {
}
#[no_mangle]
pub extern fn ppapi_on_change_focus(has_focus: bool) {
}
#[no_mangle]
pub extern fn ppapi_on_message(msg: ppapi::AnyVar) {
}
#[no_mangle]
pub extern fn ppapi_on_input(event: ppapi::input::Class) -> bool {
}
#[no_mangle]
pub extern fn ppapi_on_graphics_context_lost() {
}

These are all optional. If implemented, they will be called from the instance's task.

More info:

Reexports

pub use font::Font;
pub use gles::Context3d;
pub use input::{KeyboardInputEvent, MouseInputEvent, WheelInputEvent, TouchInputEvent, IMEInputEvent};
pub use imagedata::ImageData;
pub use url::{UrlLoader, UrlRequestInfo, UrlResponseInfo};

Modules

entry
ffi
font
fs
gles

A module to wrap OpenGLES 2.0 functions from the PPAPI

imagedata
input
pp
ppb

PPB related interfaces. Many interfaces have convenience functions to remove much of the verbose-ness of the originals.

url

Structs

ArrayBufferVar
ArrayVar
ArrayVarIter
Console
Context2d
DictEntries
DictionaryVar
Instance
MessageLoop
Messaging
NullVar
ObjectVar
Size
StringVar
UndefinedVar
View

Enums

AnyVar
Code
ResourceType

Traits

ByRefVar
Callback

INTERNAL

ContextResource
FromVar
Resource
ToFFIBool
ToOption
ToStringVar
ToVar
UnwrapOr
Var

by default all functions return false/None so one doesn't have to impl all of them.

Functions

PPP_InitializeModule
PPP_ShutdownModule
is_main_thread
mount

Type Definitions

FloatPoint
Point
Rect
Result
Ticks
Time
TouchPoint