Trait jnat::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

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>