1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
use rombok_macro;
/// This is an attribute macro that adds a getter method to the structure.
///
/**
* # Example
```rust
use rombok::Getter;
#[Getter]
struct Person {
name: String,
age: u8,
}
fn main() {
let person = Person {
name: "John".to_string(),
age: 30,
};
let name = person.get_name();
let age = person.get_age();
println!("Hello, world!: {name}, {age}");
}
```
*/
pub use rombok_macro::Getter;
/// This is an attribute macro that adds a setter method to the structure.
///
/**
* # Example
```rust
use rombok::Setter;
#[Setter]
struct Person {
name: String,
age: u8,
}
fn main() {
let mut person = Person {
name: "John".to_string(),
age: 30,
};
person.set_name("Jane".to_string());
person.set_age(31);
println!("Hello, world!: {}, {}", person.name, person.age);
}
```
*/
pub use rombok_macro::Setter;
/// This is an attribute macro that adds a `with value` method to the structure.
///
/**
* # Example
```rust
use rombok::With;
#[With]
struct Person {
name: String,
age: u8,
}
fn main() {
let person = Person {
name: "".to_string(),
age: 0,
}.with_name("Jane".to_string()).with_age(31);
let person = person.with_name("tom".to_string()).with_age(44);
println!("Hello, world!: {}, {}", person.name, person.age);
}
```
*/
pub use rombok_macro::With;
/// This is an attribute macro that creates Builder classes and builder methods for the structure.
///
/// # Example
/**
* # Example
```rust
use rombok::Builder;
#[Builder]
struct Person {
name: String,
age: u8,
}
fn main() {
let person = Person::builder()
.name("Jane".to_string())
.age(31)
.build();
println!("Hello, world!: {}, {}", person.name, person.age);
}
```
*/
pub use rombok_macro::Builder;