Crate jaded_derive[−][src]
Derive macro for automatically implementing jaded::FromJava for Rust types.
This is provided as a FromJava
macro.
Most implementations of FromJava will be very similar and automatically deriving them makes much more sense that writing almost identical impl blocks for every type.
For a ‘simple’ bean style Java class, eg
public class Person implements Serializable {
private String firstName;
private String familyName;
private int age;
}
The rust equivalent can be automatically derived
ⓘ
#[derive(FromJava)] struct Person { firstName: String, familyName: String, age: i32, }
To allow both Java and rust to keep to their respective naming conventions, a ‘rename’ feature is available that allows camelCase java fields to be read into snake_case rust fields
ⓘ
#[derive(FromJava)] #[jaded(rename)] struct Person { first_name: String, family_name: String, age: i32, }
Derive Macros
FromJava | Derive FromJava for custom Rust types |