pub struct Optional<T>(/* private fields */);Expand description
java/util/Optional
Implementations§
Source§impl<T> Optional<T>where
T: Object,
impl<T> Optional<T>where
T: Object,
Sourcepub fn is_empty(&self, e: &mut Env<'_>) -> bool
pub fn is_empty(&self, e: &mut Env<'_>) -> bool
Is this Optional empty? (equivalent to [Option.is_none])
Sourcepub fn get(&self, e: &mut Env<'_>) -> T
pub fn get(&self, e: &mut Env<'_>) -> T
Extract the value from the optional, throwing a Java exception if it was empty.
(equivalent to [Option.unwrap])
Sourcepub fn to_option(self, e: &mut Env<'_>) -> Option<T>
pub fn to_option(self, e: &mut Env<'_>) -> Option<T>
Infallibly convert this java Optional<T> to a rust Option<T>.
Sourcepub fn from_option(o: Option<T>, e: &mut Env<'_>) -> Self
pub fn from_option(o: Option<T>, e: &mut Env<'_>) -> Self
Infallibly convert create a java Optional<T> from a rust Option<T>.
Trait Implementations§
Source§impl<T> Object for Optional<T>where
T: Object,
impl<T> Object for Optional<T>where
T: Object,
Source§fn downcast_ref(&self, e: &mut Env<'_>) -> Object
fn downcast_ref(&self, e: &mut Env<'_>) -> Object
Create an object reference from
&selfSource§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 SelfSource§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 SelfSource§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 selfSource§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> Freeze for Optional<T>
impl<T> RefUnwindSafe for Optional<T>where
T: RefUnwindSafe,
impl<T> Send for Optional<T>where
T: Send,
impl<T> Sync for Optional<T>where
T: Sync,
impl<T> Unpin for Optional<T>where
T: Unpin,
impl<T> UnwindSafe for Optional<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