duchess

Struct Java

source
pub struct Java<T: JavaObject> { /* private fields */ }
Expand description

An owned reference to a non-null Java object of type T.

The JVM will not release this object until the Rust reference is dropped.

Implementations§

source§

impl<R: JavaObject> Java<R>

source

pub fn upcast<S>(self) -> Java<S>
where R: Upcast<S>, S: JavaObject + 'static,

Trait Implementations§

source§

impl<R, S> AsRef<S> for Java<R>
where R: Upcast<S>, S: JavaObject + 'static,

source§

fn as_ref(&self) -> &S

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<T: JavaObject> Debug for Java<T>

source§

fn fmt(&self, __f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: JavaObject> Deref for Java<T>

source§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T: JavaObject> Drop for Java<T>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<T: JavaObject> Hash for Java<T>

source§

fn hash<__H: Hasher>(&self, __state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<J> IntoRust<Java<J>> for &J
where J: JavaObject,

source§

fn into_rust<'jvm>(self, jvm: &mut Jvm<'jvm>) -> LocalResult<'jvm, Java<J>>

source§

impl<R, J> IntoRust<R> for &Java<J>
where J: JavaObject, for<'a> &'a J: IntoRust<R>,

source§

fn into_rust<'jvm>(self, jvm: &mut Jvm<'jvm>) -> LocalResult<'jvm, R>

source§

impl<R, J> IntoRust<R> for Java<J>
where J: JavaObject, for<'a> &'a J: IntoRust<R>,

source§

fn into_rust<'jvm>(self, jvm: &mut Jvm<'jvm>) -> LocalResult<'jvm, R>

source§

impl<T> JDeref for Java<T>
where T: JavaObject,

source§

fn jderef(&self) -> &T

Dereference to a plain reference to the java object.
source§

impl<R: JavaObject> JvmOp for &Java<R>

source§

type Output<'jvm> = &Java<R>

source§

fn do_jni<'jvm>( self, _jvm: &mut Jvm<'jvm>, ) -> LocalResult<'jvm, Self::Output<'jvm>>

Internal method
source§

fn assert_not_null<T>(self) -> NotNull<Self>
where T: JavaObject, for<'jvm> Self: JvmOp<Output<'jvm> = Option<Local<'jvm, T>>>,

source§

fn upcast<To>(self) -> AsUpcast<Self, To>
where for<'jvm> Self::Output<'jvm>: AsJRef<To>, To: JavaObject,

Most duchess-wrapped Java objects will automatically be able to call all methods defined on any of its super classes or interfaces it implements, but this can be used to “force” the output of the operation to be typed as an explicit super type To.
source§

fn catch<J>(self) -> TryCatch<Self, J>
where J: Upcast<Throwable>,

source§

fn execute<R>(self) -> Result<R>
where for<'jvm> Self::Output<'jvm>: IntoRust<R>,

Execute on the JVM, starting a JVM instance if necessary. Read more
source§

fn execute_with<'jvm, R>(self, jvm: &mut Jvm<'jvm>) -> LocalResult<'jvm, R>
where for<'j> Self::Output<'j>: IntoRust<R>,

Internal method
source§

impl<T: JavaObject> PartialEq for Java<T>

source§

fn eq(&self, __other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> TryJDeref for Java<T>
where T: JavaObject,

source§

type Java = T

The Java type (e.g., java::lang::Object).
source§

fn try_jderef(&self) -> Nullable<&T>

Dereference to a plain reference to the java object, or Err if it is null.
source§

impl<T: JavaObject> Eq for Java<T>

source§

impl<T: JavaObject> Send for Java<T>

source§

impl<T: JavaObject> Sync for Java<T>

Auto Trait Implementations§

§

impl<T> Freeze for Java<T>

§

impl<T> RefUnwindSafe for Java<T>
where T: RefUnwindSafe,

§

impl<T> Unpin for Java<T>
where T: Unpin,

§

impl<T> UnwindSafe for Java<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<R> ToJava for R
where R: ?Sized,

source§

type JvmOp<'a, J: Upcast<Object> + Upcast<J>> = ToJavaOp<'a, R, J> where R: 'a + ToJavaImpl<J>

source§

fn to_java<J>(&self) -> ToJavaOp<'_, R, J>
where R: ToJavaImpl<J>, J: Upcast<Object> + Upcast<J>,

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more