rust-qt-binding-generator/tests/rust_objects/src/implementation.rs

76 lines
1.6 KiB
Rust
Raw Normal View History

2017-08-26 10:10:18 -07:00
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(dead_code)]
use interface::*;
pub struct Group {
emit: GroupEmitter,
person: Person,
}
impl GroupTrait for Group {
fn new(emit: GroupEmitter, person: Person) -> Group {
Group {
emit: emit,
person: person,
}
}
fn emit(&mut self) -> &mut GroupEmitter {
&mut self.emit
}
2017-08-31 00:01:14 -07:00
fn person(&self) -> &Person {
&self.person
}
fn person_mut(&mut self) -> &mut Person {
&mut self.person
}
}
2017-08-26 10:10:18 -07:00
pub struct InnerObject {
emit: InnerObjectEmitter,
description: String,
}
impl InnerObjectTrait for InnerObject {
fn new(emit: InnerObjectEmitter) -> InnerObject {
2017-08-26 10:10:18 -07:00
InnerObject {
emit: emit,
description: String::new(),
}
}
fn emit(&mut self) -> &mut InnerObjectEmitter {
&mut self.emit
2017-08-26 10:10:18 -07:00
}
2017-08-31 00:01:14 -07:00
fn description(&self) -> &str {
&self.description
2017-08-26 10:10:18 -07:00
}
fn set_description(&mut self, value: String) {
self.description = value;
self.emit.description_changed();
}
2017-08-29 11:37:51 -07:00
}
2017-08-26 10:10:18 -07:00
pub struct Person {
emit: PersonEmitter,
object: InnerObject,
}
impl PersonTrait for Person {
fn new(emit: PersonEmitter, object: InnerObject) -> Person {
2017-08-26 10:10:18 -07:00
Person {
emit: emit,
object: object,
}
}
fn emit(&mut self) -> &mut PersonEmitter {
&mut self.emit
2017-08-26 10:10:18 -07:00
}
2017-08-31 00:01:14 -07:00
fn object(&self) -> &InnerObject {
2017-08-26 10:10:18 -07:00
&self.object
}
fn object_mut(&mut self) -> &mut InnerObject {
2017-08-26 10:10:18 -07:00
&mut self.object
}
}