pub struct JMap<'a: 'b, 'b> { /* private fields */ }
Expand description
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
sourceimpl<'a: 'b, 'b> JMap<'a, 'b>
impl<'a: 'b, 'b> JMap<'a, 'b>
sourcepub fn from_env(env: &'b JNIEnv<'a>, obj: JObject<'a>) -> Result<JMap<'a, 'b>>
pub fn from_env(env: &'b JNIEnv<'a>, obj: JObject<'a>) -> Result<JMap<'a, 'b>>
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.
sourcepub fn get(&self, key: JObject<'a>) -> Result<Option<JObject<'a>>>
pub fn get(&self, key: JObject<'a>) -> Result<Option<JObject<'a>>>
Look up the value for a key. Returns Some
if it’s found and None
if
a null pointer would be returned.
sourcepub fn put(
&self,
key: JObject<'a>,
value: JObject<'a>
) -> Result<Option<JObject<'a>>>
pub fn put(
&self,
key: JObject<'a>,
value: JObject<'a>
) -> Result<Option<JObject<'a>>>
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.
Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more