pub struct Runtime { /* private fields */ }Expand description
The pieces of the Android runtime this crate needs, resolved once.
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub fn init(vm: Vm, context: JObject) -> Result<&'static Runtime, Error>
pub fn init(vm: Vm, context: JObject) -> Result<&'static Runtime, Error>
Start the runtime with a VM and an Android Context.
context may be null, in which case the application context is looked
up through ActivityThread.currentApplication() — which works inside a
normal app process and nowhere else.
Sourcepub fn get() -> Option<&'static Runtime>
pub fn get() -> Option<&'static Runtime>
The runtime, if Runtime::init has run.
pub fn vm(&self) -> Vm
Sourcepub fn env(&self) -> Result<Env, Error>
pub fn env(&self) -> Result<Env, Error>
An environment for the calling thread, attaching it if necessary.
Sourcepub fn define_class(
&self,
binary_name: &str,
dex_bytes: Vec<u8>,
natives: &[(&str, &str, *const c_void)],
) -> Result<JClass, Error>
pub fn define_class( &self, binary_name: &str, dex_bytes: Vec<u8>, natives: &[(&str, &str, *const c_void)], ) -> Result<JClass, Error>
Define a class from a DEX and bind its native methods.
Returns a global reference, cached — asking twice is free and yields the
same class, which matters because two Class objects from two loaders
are not interchangeable.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Runtime
impl RefUnwindSafe for Runtime
impl Unpin for Runtime
impl UnsafeUnpin for Runtime
impl UnwindSafe for Runtime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more