Cast

Trait Cast 

Source
pub trait Cast<'env, As: Cast<'env, Object<'env>>>:
    JavaType<__JniType = jobject>
    + ToJni
    + FromJni<'env> {
    // Required method
    fn cast<'a>(&'a self) -> &'a As;
}
Expand description

A trait for casting Java object types to their superclasses.

Required Methods§

Source

fn cast<'a>(&'a self) -> &'a As

Cast the object to itself or one of it’s superclasses.

Doesn’t actually convert anything, the result is just the same object interpreted as one of it’s superclasses.

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.

Implementors§

Source§

impl<'env> Cast<'env, Class<'env>> for Class<'env>

Make Class castable to itself.

Source§

impl<'env> Cast<'env, Object<'env>> for Class<'env>

Make Class castable to Object.

Source§

impl<'env> Cast<'env, Object<'env>> for Object<'env>

Make Object castable to itself.

Source§

impl<'env> Cast<'env, Object<'env>> for String<'env>

Make String castable to Object.

Source§

impl<'env> Cast<'env, Object<'env>> for Throwable<'env>

Make Throwable castable to Object.

Source§

impl<'env> Cast<'env, String<'env>> for String<'env>

Make String castable to itself.

Source§

impl<'env> Cast<'env, Throwable<'env>> for Throwable<'env>

Make Throwable castable to itself.