Warning, /sdk/rust-qt-binding-generator/tests/rust_tree/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 } 0010 0011 pub struct Persons { 0012 emit: PersonsEmitter, 0013 model: PersonsTree, 0014 list: Vec<PersonsItem>, 0015 } 0016 0017 impl PersonsTrait for Persons { 0018 fn new(emit: PersonsEmitter, model: PersonsTree) -> Persons { 0019 Persons { 0020 emit: emit, 0021 model: model, 0022 list: vec![PersonsItem::default(); 10], 0023 } 0024 } 0025 fn emit(&mut self) -> &mut PersonsEmitter { 0026 &mut self.emit 0027 } 0028 fn row_count(&self, index: Option<usize>) -> usize { 0029 self.list.len() 0030 } 0031 fn index(&self, index: Option<usize>, row: usize) -> usize { 0032 0 0033 } 0034 fn parent(&self, index: usize) -> Option<usize> { 0035 None 0036 } 0037 fn row(&self, index: usize) -> usize { 0038 index 0039 } 0040 fn check_row(&self, index: usize, _row: usize) -> Option<usize> { 0041 if index < self.list.len() { 0042 Some(index) 0043 } else { 0044 None 0045 } 0046 } 0047 fn user_name(&self, index: usize) -> &str { 0048 &self.list[index].user_name 0049 } 0050 fn set_user_name(&mut self, index: usize, v: String) -> bool { 0051 self.list[index].user_name = v; 0052 true 0053 } 0054 } 0055