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 type | java type | notes |
|---|---|---|
T where T: java::Class | fully qualified class path | |
Result<T, java::lang::Throwable> | T::PATH | java::Class must be implemented for T |
java::Nullable<T> | T::PATH | java::Class must be implemented for T |
java::NoUpcast<T> | java::lang::Object | java::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::Object | java.lang.Object | |
Vec<T> | T[] | T must be java::Type |
String | java.lang.String | java::Class and java::Object implemented for String |
() | void | |
u16 | char | |
i8 | byte | |
i16 | short | |
i32 | int | |
i64 | long | |
f32 | float | |
f64 | double | |
fn(T,*) -> R | corresponding java type signature | all argument types and return types must be java::Type |
Required Associated Constants§
Required Methods§
Provided Methods§
Sourcefn is_type_of(e: &mut Env<'_>, o: &JObject<'_>) -> bool
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.