[][src]Struct uni_tmp_jni::objects::JMap

pub struct JMap<'a: 'b, 'b> { /* fields omitted */ }

Wrapper for JObjects that implement java/util/Map. Provides methods to get and set entries and a way to iterate over key/value pairs.

Looks up the class and method ids on creation rather than for every method call.

Implementations

impl<'a: 'b, 'b> JMap<'a, 'b>[src]

pub fn from_env(env: &'b JNIEnv<'a>, obj: JObject<'a>) -> Result<JMap<'a, 'b>>[src]

Create a map from the environment and an object. This looks up the necessary class and method ids to call all of the methods on it so that exra work doesn't need to be done on every method call.

pub fn get(&self, key: JObject<'a>) -> Result<Option<JObject<'a>>>[src]

Look up the value for a key. Returns Some if it's found and None if a null pointer would be returned.

pub fn put(
    &self,
    key: JObject<'a>,
    value: JObject<'a>
) -> Result<Option<JObject<'a>>>
[src]

Look up the value for a key. Returns Some with the old value if the key already existed and None if it's a new key.

pub fn remove(&self, key: JObject<'a>) -> Result<Option<JObject<'a>>>[src]

Remove a value from the map. Returns Some with the removed value and None if there was no value for the key.

pub fn iter(&self) -> Result<JMapIter<'a, 'b, '_>>[src]

Get key/value iterator for the map. This is done by getting the EntrySet from java and iterating over it.

Methods from Deref<Target = JObject<'a>>

Trait Implementations

impl<'a: 'b, 'b> Deref for JMap<'a, 'b>[src]

type Target = JObject<'a>

The resulting type after dereferencing.

impl<'a: 'b, 'b> From<JMap<'a, 'b>> for JObject<'a>[src]

Auto Trait Implementations

impl<'a, 'b> RefUnwindSafe for JMap<'a, 'b>

impl<'a, 'b> !Send for JMap<'a, 'b>

impl<'a, 'b> !Sync for JMap<'a, 'b>

impl<'a, 'b> Unpin for JMap<'a, 'b> where
    'a: 'b, 

impl<'a, 'b> UnwindSafe for JMap<'a, 'b>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.