Array

Trait Array 

Source
pub trait Array<'a, T, J> {
    // Required methods
    fn new(env: &'a Env<'a>, length: usize) -> Self;
    fn from(env: &'a Env<'a>, array: J) -> Self;
    fn length(&self) -> usize;
    fn get(&self, index: usize) -> Result<T>;
    fn set(&self, index: usize, value: T) -> Result<()>;
}
Expand description

A trait for wrapped JNI arrays

Required Methods§

Source

fn new(env: &'a Env<'a>, length: usize) -> Self

Create a new array with the given length

§Arguments
  • env - The environment
  • length - The length of the array
Source

fn from(env: &'a Env<'a>, array: J) -> Self

Create a new array from a JNI array

§Arguments
  • env - The environment
  • array - The JNI array
Source

fn length(&self) -> usize

Get the length of the array

Source

fn get(&self, index: usize) -> Result<T>

Get the value at the given index

§Arguments
  • index - The index
Source

fn set(&self, index: usize, value: T) -> Result<()>

Set the value at the given index

§Arguments
  • index - The index
  • value - The value

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§

Source§

impl<'a> Array<'a, bool, JPrimitiveArray<'a, u8>> for BooleanArray<'a>

Source§

impl<'a> Array<'a, char, JPrimitiveArray<'a, u16>> for CharArray<'a>

Source§

impl<'a> Array<'a, f32, JPrimitiveArray<'a, f32>> for FloatArray<'a>

Source§

impl<'a> Array<'a, f64, JPrimitiveArray<'a, f64>> for DoubleArray<'a>

Source§

impl<'a> Array<'a, i8, JPrimitiveArray<'a, i8>> for ByteArray<'a>

Source§

impl<'a> Array<'a, i16, JPrimitiveArray<'a, i16>> for ShortArray<'a>

Source§

impl<'a> Array<'a, i32, JPrimitiveArray<'a, i32>> for IntArray<'a>

Source§

impl<'a> Array<'a, i64, JPrimitiveArray<'a, i64>> for LongArray<'a>

Source§

impl<'a> Array<'a, JObject<'a>, JObjectArray<'a>> for ObjectArray<'a>