Type

Trait Type 

Source
pub trait Type: TypeSealed {
    const SIG: Signature;

    // Required method
    fn jni() -> JavaType;

    // Provided method
    fn is_type_of(e: &mut Env<'_>, o: &JObject<'_>) -> bool { ... }
}
Expand description

A type that has a corresponding Java type

§Sealed

You can’t implement this trait directly; instead you can define new java::Classes, which will then come with Type implementations for free.

§Conversions

rust typejava typenotes
T where T: java::Classfully qualified class path
Result<T, java::lang::Throwable>T::PATHjava::Class must be implemented for T
java::Nullable<T>T::PATHjava::Class must be implemented for T
java::NoUpcast<T>java::lang::Objectjava::Class must be implemented for T. Used when a method should have the signature of returning T, but you would like the object reference without java::Object::upcasting.
java::lang::Objectjava.lang.Object
Vec<T>T[]T must be java::Type
Stringjava.lang.Stringjava::Class and java::Object implemented for String
()void
u16char
i8byte
i16short
i32int
i64long
f32float
f64double
fn(T,*) -> Rcorresponding java type signatureall argument types and return types must be java::Type

Required Associated Constants§

Source

const SIG: Signature

The signature for this type

Required Methods§

Source

fn jni() -> JavaType

Get the jni rep of this type

Provided Methods§

Source

fn is_type_of(e: &mut Env<'_>, o: &JObject<'_>) -> bool

Determines whether an object is an instance of this type

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Type for bool

Source§

impl Type for f32

Source§

impl Type for f64

Source§

impl Type for i8

Source§

impl Type for i16

Source§

impl Type for i32

Source§

impl Type for i64

Source§

impl Type for u16

Source§

impl Type for ()

Source§

impl Type for GlobalRef

Source§

const SIG: Signature = java::lang::Object::SIG

Source§

fn jni() -> JavaType

Source§

impl<R> Type for fn() -> R
where R: Type,

Source§

impl<R, A> Type for fn(A) -> R
where R: Type, A: Type,

Source§

impl<R, A, B> Type for fn(A, B) -> R
where R: Type, A: Type, B: Type,

Source§

impl<R, A, B, C> Type for fn(A, B, C) -> R
where R: Type, A: Type, B: Type, C: Type,

Source§

impl<R, A, B, C, D> Type for fn(A, B, C, D) -> R
where R: Type, A: Type, B: Type, C: Type, D: Type,

Source§

impl<R, A, B, C, D, E> Type for fn(A, B, C, D, E) -> R
where R: Type, A: Type, B: Type, C: Type, D: Type, E: Type,

Source§

impl<T> Type for Result<T, Throwable>
where T: Class,

Source§

impl<T> Type for Vec<T>
where T: Type,

Implementors§

Source§

impl<T> Type for T
where T: Class,