Warning, /sdk/rust-qt-binding-generator/tests/rust_list/src/implementation.rs is written in an unsupported language. File is not indexed.
0001 #![allow(unused_imports)] 0002 #![allow(unused_variables)] 0003 #![allow(dead_code)] 0004 use interface::*; 0005 0006 #[derive(Default, Clone)] 0007 struct PersonsItem { 0008 user_name: String, 0009 age: u8, 0010 } 0011 0012 pub struct Persons { 0013 emit: PersonsEmitter, 0014 model: PersonsList, 0015 list: Vec<PersonsItem>, 0016 } 0017 0018 impl PersonsTrait for Persons { 0019 fn new(emit: PersonsEmitter, model: PersonsList) -> Persons { 0020 Persons { 0021 emit: emit, 0022 model: model, 0023 list: vec![PersonsItem::default(); 10], 0024 } 0025 } 0026 fn emit(&mut self) -> &mut PersonsEmitter { 0027 &mut self.emit 0028 } 0029 fn row_count(&self) -> usize { 0030 self.list.len() 0031 } 0032 fn user_name(&self, index: usize) -> &str { 0033 &self.list[index].user_name 0034 } 0035 fn set_user_name(&mut self, index: usize, v: String) -> bool { 0036 self.list[index].user_name = v; 0037 true 0038 } 0039 } 0040 0041 pub struct NoRole { 0042 emit: NoRoleEmitter, 0043 model: NoRoleList, 0044 list: Vec<PersonsItem> 0045 } 0046 0047 impl NoRoleTrait for NoRole { 0048 fn new(emit: NoRoleEmitter, model: NoRoleList) -> NoRole { 0049 NoRole { 0050 emit: emit, 0051 model: model, 0052 list: vec![PersonsItem::default(); 10], 0053 } 0054 } 0055 fn emit(&mut self) -> &mut NoRoleEmitter { 0056 &mut self.emit 0057 } 0058 fn row_count(&self) -> usize { 0059 self.list.len() 0060 } 0061 fn user_name(&self, index: usize) -> &str { 0062 &self.list[index].user_name 0063 } 0064 fn set_user_name(&mut self, index: usize, v: String) -> bool { 0065 self.list[index].user_name = v; 0066 true 0067 } 0068 fn user_age(&self, index: usize) -> u8 { 0069 self.list[index].age 0070 } 0071 fn set_user_age(&mut self, index: usize, v: u8) -> bool { 0072 self.list[index].age = v; 0073 true 0074 } 0075 }