TypedObjectArrayExt

Trait TypedObjectArrayExt 

Source
pub trait TypedObjectArrayExt: TypedArrayExt {
    // Required methods
    fn typed_new_array<T: ObjectType, R: StrongRef>(
        &self,
        cls: &Class<R, T>,
        len: i32,
    ) -> Result<LocalObject<'_, Array<T>>, LocalObject<'_, JavaThrowable>>;
    fn typed_new_array_with_initial<T: ObjectType, R: StrongRef, IR: StrongRef>(
        &self,
        cls: &Class<R, T>,
        len: i32,
        initial: &Object<IR, T>,
    ) -> Result<LocalObject<'_, Array<T>>, LocalObject<'_, JavaThrowable>>;
    fn typed_get_array_element<T: ObjectType, R: StrongRef>(
        &self,
        arr: &Object<R, Array<T>>,
        index: i32,
    ) -> Result<Option<LocalObject<'_, T>>, LocalObject<'_, JavaThrowable>>;
    fn typed_set_array_element<T: ObjectType, R: StrongRef>(
        &self,
        arr: &Object<R, Array<T>>,
        index: i32,
        value: Option<&Object<R, T>>,
    ) -> Result<(), LocalObject<'_, JavaThrowable>>;
}
Expand description

Extension methods for typed object arrays.

Required Methods§

Source

fn typed_new_array<T: ObjectType, R: StrongRef>( &self, cls: &Class<R, T>, len: i32, ) -> Result<LocalObject<'_, Array<T>>, LocalObject<'_, JavaThrowable>>

Create a new object array.

Source

fn typed_new_array_with_initial<T: ObjectType, R: StrongRef, IR: StrongRef>( &self, cls: &Class<R, T>, len: i32, initial: &Object<IR, T>, ) -> Result<LocalObject<'_, Array<T>>, LocalObject<'_, JavaThrowable>>

Create a new object array with initial value.

Source

fn typed_get_array_element<T: ObjectType, R: StrongRef>( &self, arr: &Object<R, Array<T>>, index: i32, ) -> Result<Option<LocalObject<'_, T>>, LocalObject<'_, JavaThrowable>>

Get an element from object array.

Source

fn typed_set_array_element<T: ObjectType, R: StrongRef>( &self, arr: &Object<R, Array<T>>, index: i32, value: Option<&Object<R, T>>, ) -> Result<(), LocalObject<'_, JavaThrowable>>

Set an element to object array.

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.

Implementations on Foreign Types§

Source§

impl<'vm> TypedObjectArrayExt for JNIEnv<'vm>

Source§

fn typed_new_array<T: ObjectType, R: StrongRef>( &self, cls: &Class<R, T>, len: i32, ) -> Result<LocalObject<'_, Array<T>>, LocalObject<'_, JavaThrowable>>

Source§

fn typed_new_array_with_initial<T: ObjectType, R: StrongRef, IR: StrongRef>( &self, cls: &Class<R, T>, len: i32, initial: &Object<IR, T>, ) -> Result<LocalObject<'_, Array<T>>, LocalObject<'_, JavaThrowable>>

Source§

fn typed_get_array_element<T: ObjectType, R: StrongRef>( &self, arr: &Object<R, Array<T>>, index: i32, ) -> Result<Option<LocalObject<'_, T>>, LocalObject<'_, JavaThrowable>>

Source§

fn typed_set_array_element<T: ObjectType, R: StrongRef>( &self, arr: &Object<R, Array<T>>, index: i32, value: Option<&Object<R, T>>, ) -> Result<(), LocalObject<'_, JavaThrowable>>

Implementors§