pub struct Nullable<T>(_, _);
Expand description
Helper type that wraps a type T
without
invoking java::Object::upcast
on it, preventing
potential NullPointerExceptions.
Implementations§
source§impl<T> Nullable<T>where
T: Class,
impl<T> Nullable<T>where T: Class,
sourcepub fn into_option(self, e: &mut Env<'_>) -> Option<T>
pub fn into_option(self, e: &mut Env<'_>) -> Option<T>
Convert this to Option
<T>
, invoking java::Object::upcast
only if the object reference is non-null.
Trait Implementations§
source§impl<T> Object for Nullable<T>where
T: Class,
impl<T> Object for Nullable<T>where T: Class,
source§fn downcast_ref(&self, e: &mut Env<'_>) -> Object
fn downcast_ref(&self, e: &mut Env<'_>) -> Object
Create an object reference from
&self
source§fn upcast_value_ref<'e>(e: &mut Env<'e>, jv: JValue<'e, '_>) -> Selfwhere
Self: Sized,
fn upcast_value_ref<'e>(e: &mut Env<'e>, jv: JValue<'e, '_>) -> Selfwhere Self: Sized,
Try to interpret a
JValue
as Self
source§fn upcast_value<'e>(e: &mut Env<'e>, jv: JValueOwned<'e>) -> Selfwhere
Self: Sized,
fn upcast_value<'e>(e: &mut Env<'e>, jv: JValueOwned<'e>) -> Selfwhere Self: Sized,
Try to interpret a
JValueOwned
as Self
source§fn downcast_value<'e>(self, e: &mut Env<'e>) -> JValueOwned<'e>where
Self: Sized,
fn downcast_value<'e>(self, e: &mut Env<'e>) -> JValueOwned<'e>where Self: Sized,
Create a
JValueOwned
from self
source§fn yield_to_java(&self, e: &mut Env<'_>) -> jobject
fn yield_to_java(&self, e: &mut Env<'_>) -> jobject
Use this to yield ownership of a
java::lang::Object
to the JVM, for example when returning a jobject
from a
native function.Auto Trait Implementations§
impl<T> RefUnwindSafe for Nullable<T>where T: RefUnwindSafe,
impl<T> Send for Nullable<T>where T: Send,
impl<T> Sync for Nullable<T>where T: Sync,
impl<T> Unpin for Nullable<T>where T: Unpin,
impl<T> UnwindSafe for Nullable<T>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<F, A, TF, T> Sequence<F, A, TF> for T
impl<F, A, TF, T> Sequence<F, A, TF> for T
source§fn sequence<Ap>(self) -> <Ap as HKT1>::T<<F as HKT1>::T<A>>where
Self: Sized + Traversable<F, <Ap as HKT1>::T<A>, A, TF> + Foldable<F, <Ap as HKT1>::T<A>>,
Ap: HKT1,
<Ap as HKT1>::T<A>: Applicative<Ap, A> + ApplyOnce<Ap, A>,
<Ap as HKT1>::T<TF>: Applicative<Ap, TF> + ApplyOnce<Ap, TF>,
<Ap as HKT1>::T<<F as HKT1>::T<A>>: Applicative<Ap, <F as HKT1>::T<A>> + ApplyOnce<Ap, <F as HKT1>::T<A>>,
F: HKT1<T<<Ap as HKT1>::T<A>> = Self>,
fn sequence<Ap>(self) -> <Ap as HKT1>::T<<F as HKT1>::T<A>>where Self: Sized + Traversable<F, <Ap as HKT1>::T<A>, A, TF> + Foldable<F, <Ap as HKT1>::T<A>>, Ap: HKT1, <Ap as HKT1>::T<A>: Applicative<Ap, A> + ApplyOnce<Ap, A>, <Ap as HKT1>::T<TF>: Applicative<Ap, TF> + ApplyOnce<Ap, TF>, <Ap as HKT1>::T<<F as HKT1>::T<A>>: Applicative<Ap, <F as HKT1>::T<A>> + ApplyOnce<Ap, <F as HKT1>::T<A>>, F: HKT1<T<<Ap as HKT1>::T<A>> = Self>,
See
Sequence