Pass the emitter as mutable. It is pointless otherwise.
parent
fa337c37b1
commit
385ae17bb7
|
@ -44,8 +44,8 @@ impl DemoTrait for Demo {
|
|||
time_series
|
||||
}
|
||||
}
|
||||
fn emit(&self) -> &DemoEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut DemoEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn fibonacci(&self) -> &Fibonacci {
|
||||
&self.fibonacci
|
||||
|
|
|
@ -53,8 +53,8 @@ impl FibonacciTrait for Fibonacci {
|
|||
result: Arc::new(AtomicUsize::new(0)),
|
||||
}
|
||||
}
|
||||
fn emit(&self) -> &FibonacciEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut FibonacciEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn input(&self) -> u32 {
|
||||
self.input
|
||||
|
@ -87,8 +87,8 @@ impl FibonacciListTrait for FibonacciList {
|
|||
emit,
|
||||
}
|
||||
}
|
||||
fn emit(&self) -> &FibonacciListEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut FibonacciListEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn row_count(&self) -> usize {
|
||||
93
|
||||
|
|
|
@ -228,8 +228,8 @@ where
|
|||
tree.reset();
|
||||
tree
|
||||
}
|
||||
fn emit(&self) -> &FileSystemTreeEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut FileSystemTreeEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn path(&self) -> Option<&str> {
|
||||
self.path.as_ref().map(|s| &s[..])
|
||||
|
|
|
@ -89,8 +89,12 @@ fn handle_tasks(processes: &mut HashMap<pid_t, ProcessItem>) -> Vec<pid_t> {
|
|||
let pids: Vec<pid_t> = processes.keys().cloned().collect();
|
||||
for pid in pids {
|
||||
if let Some(parent) = processes[&pid].process.parent {
|
||||
let p = processes.get_mut(&parent).unwrap();
|
||||
p.tasks.push(pid);
|
||||
if let Some(p) = processes.get_mut(&parent) {
|
||||
p.tasks.push(pid);
|
||||
} else {
|
||||
println!("no parent for {}", pid);
|
||||
top.push(pid);
|
||||
}
|
||||
} else {
|
||||
top.push(pid);
|
||||
}
|
||||
|
@ -334,8 +338,8 @@ impl ProcessesTrait for Processes {
|
|||
update_thread(emit, p.incoming.clone(), p.active, rx);
|
||||
p
|
||||
}
|
||||
fn emit(&self) -> &ProcessesEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut ProcessesEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn row_count(&self, index: Option<usize>) -> usize {
|
||||
if let Some(index) = index {
|
||||
|
|
|
@ -46,8 +46,8 @@ impl TimeSeriesTrait for TimeSeries {
|
|||
}
|
||||
series
|
||||
}
|
||||
fn emit(&self) -> &TimeSeriesEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut TimeSeriesEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn row_count(&self) -> usize {
|
||||
self.list.len() as usize
|
||||
|
|
|
@ -125,7 +125,7 @@ pub trait DemoTrait {
|
|||
file_system_tree: FileSystemTree,
|
||||
processes: Processes,
|
||||
time_series: TimeSeries) -> Self;
|
||||
fn emit(&self) -> &DemoEmitter;
|
||||
fn emit(&mut self) -> &mut DemoEmitter;
|
||||
fn fibonacci(&self) -> &Fibonacci;
|
||||
fn fibonacci_mut(&mut self) -> &mut Fibonacci;
|
||||
fn fibonacci_list(&self) -> &FibonacciList;
|
||||
|
@ -369,7 +369,7 @@ impl FibonacciEmitter {
|
|||
|
||||
pub trait FibonacciTrait {
|
||||
fn new(emit: FibonacciEmitter) -> Self;
|
||||
fn emit(&self) -> &FibonacciEmitter;
|
||||
fn emit(&mut self) -> &mut FibonacciEmitter;
|
||||
fn input(&self) -> u32;
|
||||
fn set_input(&mut self, value: u32);
|
||||
fn result(&self) -> u64;
|
||||
|
@ -498,7 +498,7 @@ impl FibonacciListList {
|
|||
|
||||
pub trait FibonacciListTrait {
|
||||
fn new(emit: FibonacciListEmitter, model: FibonacciListList) -> Self;
|
||||
fn emit(&self) -> &FibonacciListEmitter;
|
||||
fn emit(&mut self) -> &mut FibonacciListEmitter;
|
||||
fn row_count(&self) -> usize;
|
||||
fn insert_rows(&mut self, _row: usize, _count: usize) -> bool { false }
|
||||
fn remove_rows(&mut self, _row: usize, _count: usize) -> bool { false }
|
||||
|
@ -691,7 +691,7 @@ impl FileSystemTreeTree {
|
|||
|
||||
pub trait FileSystemTreeTrait {
|
||||
fn new(emit: FileSystemTreeEmitter, model: FileSystemTreeTree) -> Self;
|
||||
fn emit(&self) -> &FileSystemTreeEmitter;
|
||||
fn emit(&mut self) -> &mut FileSystemTreeEmitter;
|
||||
fn path(&self) -> Option<&str>;
|
||||
fn set_path(&mut self, value: Option<String>);
|
||||
fn row_count(&self, Option<usize>) -> usize;
|
||||
|
@ -998,7 +998,7 @@ impl ProcessesTree {
|
|||
|
||||
pub trait ProcessesTrait {
|
||||
fn new(emit: ProcessesEmitter, model: ProcessesTree) -> Self;
|
||||
fn emit(&self) -> &ProcessesEmitter;
|
||||
fn emit(&mut self) -> &mut ProcessesEmitter;
|
||||
fn active(&self) -> bool;
|
||||
fn set_active(&mut self, value: bool);
|
||||
fn row_count(&self, Option<usize>) -> usize;
|
||||
|
@ -1278,7 +1278,7 @@ impl TimeSeriesList {
|
|||
|
||||
pub trait TimeSeriesTrait {
|
||||
fn new(emit: TimeSeriesEmitter, model: TimeSeriesList) -> Self;
|
||||
fn emit(&self) -> &TimeSeriesEmitter;
|
||||
fn emit(&mut self) -> &mut TimeSeriesEmitter;
|
||||
fn row_count(&self) -> usize;
|
||||
fn insert_rows(&mut self, _row: usize, _count: usize) -> bool { false }
|
||||
fn remove_rows(&mut self, _row: usize, _count: usize) -> bool { false }
|
||||
|
|
|
@ -32,8 +32,8 @@ impl TodosTrait for Todos {
|
|||
active_count: 0,
|
||||
}
|
||||
}
|
||||
fn emit(&self) -> &TodosEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut TodosEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn active_count(&self) -> u64 {
|
||||
self.active_count as u64
|
||||
|
|
|
@ -193,7 +193,7 @@ impl TodosList {
|
|||
|
||||
pub trait TodosTrait {
|
||||
fn new(emit: TodosEmitter, model: TodosList) -> Self;
|
||||
fn emit(&self) -> &TodosEmitter;
|
||||
fn emit(&mut self) -> &mut TodosEmitter;
|
||||
fn active_count(&self) -> u64;
|
||||
fn count(&self) -> u64;
|
||||
fn add(&mut self, description: String) -> ();
|
||||
|
|
|
@ -492,7 +492,7 @@ pub trait {}Trait {{
|
|||
writeln!(
|
||||
r,
|
||||
") -> Self;
|
||||
fn emit(&self) -> &{}Emitter;",
|
||||
fn emit(&mut self) -> &mut {}Emitter;",
|
||||
o.name
|
||||
)?;
|
||||
for (name, p) in &o.properties {
|
||||
|
@ -1347,7 +1347,7 @@ fn write_rust_implementation_object(r: &mut Vec<u8>, o: &Object) -> Result<()> {
|
|||
r,
|
||||
" }}
|
||||
}}
|
||||
fn emit(&self) -> &{}Emitter {{
|
||||
fn emit(&mut self) -> &mut {}Emitter {{
|
||||
&self.emit
|
||||
}}",
|
||||
o.name
|
||||
|
|
|
@ -12,8 +12,8 @@ impl SimpleTrait for Simple {
|
|||
message: String::new(),
|
||||
}
|
||||
}
|
||||
fn emit(&self) -> &SimpleEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut SimpleEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn message(&self) -> &str {
|
||||
"Hello World!"
|
||||
|
|
|
@ -74,7 +74,7 @@ impl SimpleEmitter {
|
|||
|
||||
pub trait SimpleTrait {
|
||||
fn new(emit: SimpleEmitter) -> Self;
|
||||
fn emit(&self) -> &SimpleEmitter;
|
||||
fn emit(&mut self) -> &mut SimpleEmitter;
|
||||
fn message(&self) -> &str;
|
||||
fn set_message(&mut self, value: String);
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ impl SimpleTrait for Simple {
|
|||
message: String::new(),
|
||||
}
|
||||
}
|
||||
fn emit(&self) -> &SimpleEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut SimpleEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn message(&self) -> &str {
|
||||
"Hello World!"
|
||||
|
|
|
@ -74,7 +74,7 @@ impl SimpleEmitter {
|
|||
|
||||
pub trait SimpleTrait {
|
||||
fn new(emit: SimpleEmitter) -> Self;
|
||||
fn emit(&self) -> &SimpleEmitter;
|
||||
fn emit(&mut self) -> &mut SimpleEmitter;
|
||||
fn message(&self) -> &str;
|
||||
fn set_message(&mut self, value: String);
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ impl PersonTrait for Person {
|
|||
user_name: String::new(),
|
||||
}
|
||||
}
|
||||
fn emit(&self) -> &PersonEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut PersonEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn user_name(&self) -> &str {
|
||||
&self.user_name
|
||||
|
|
|
@ -77,7 +77,7 @@ impl PersonEmitter {
|
|||
|
||||
pub trait PersonTrait {
|
||||
fn new(emit: PersonEmitter) -> Self;
|
||||
fn emit(&self) -> &PersonEmitter;
|
||||
fn emit(&mut self) -> &mut PersonEmitter;
|
||||
fn user_name(&self) -> &str;
|
||||
fn set_user_name(&mut self, value: String);
|
||||
fn append(&mut self, suffix: String, amount: u32) -> ();
|
||||
|
|
|
@ -23,8 +23,8 @@ impl PersonsTrait for Persons {
|
|||
list: vec![PersonsItem::default(); 10],
|
||||
}
|
||||
}
|
||||
fn emit(&self) -> &PersonsEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut PersonsEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn row_count(&self) -> usize {
|
||||
self.list.len()
|
||||
|
@ -52,8 +52,8 @@ impl NoRoleTrait for NoRole {
|
|||
list: vec![PersonsItem::default(); 10],
|
||||
}
|
||||
}
|
||||
fn emit(&self) -> &NoRoleEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut NoRoleEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn row_count(&self) -> usize {
|
||||
self.list.len()
|
||||
|
|
|
@ -177,7 +177,7 @@ impl NoRoleList {
|
|||
|
||||
pub trait NoRoleTrait {
|
||||
fn new(emit: NoRoleEmitter, model: NoRoleList) -> Self;
|
||||
fn emit(&self) -> &NoRoleEmitter;
|
||||
fn emit(&mut self) -> &mut NoRoleEmitter;
|
||||
fn row_count(&self) -> usize;
|
||||
fn insert_rows(&mut self, _row: usize, _count: usize) -> bool { false }
|
||||
fn remove_rows(&mut self, _row: usize, _count: usize) -> bool { false }
|
||||
|
@ -389,7 +389,7 @@ impl PersonsList {
|
|||
|
||||
pub trait PersonsTrait {
|
||||
fn new(emit: PersonsEmitter, model: PersonsList) -> Self;
|
||||
fn emit(&self) -> &PersonsEmitter;
|
||||
fn emit(&mut self) -> &mut PersonsEmitter;
|
||||
fn row_count(&self) -> usize;
|
||||
fn insert_rows(&mut self, _row: usize, _count: usize) -> bool { false }
|
||||
fn remove_rows(&mut self, _row: usize, _count: usize) -> bool { false }
|
||||
|
|
|
@ -37,8 +37,8 @@ impl ListTrait for List {
|
|||
list: vec![ListItem::default(); 10],
|
||||
}
|
||||
}
|
||||
fn emit(&self) -> &ListEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut ListEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn row_count(&self) -> usize {
|
||||
self.list.len()
|
||||
|
|
|
@ -180,7 +180,7 @@ impl ListList {
|
|||
|
||||
pub trait ListTrait {
|
||||
fn new(emit: ListEmitter, model: ListList) -> Self;
|
||||
fn emit(&self) -> &ListEmitter;
|
||||
fn emit(&mut self) -> &mut ListEmitter;
|
||||
fn row_count(&self) -> usize;
|
||||
fn insert_rows(&mut self, _row: usize, _count: usize) -> bool { false }
|
||||
fn remove_rows(&mut self, _row: usize, _count: usize) -> bool { false }
|
||||
|
|
|
@ -15,8 +15,8 @@ impl PersonTrait for Person {
|
|||
user_name: String::new(),
|
||||
}
|
||||
}
|
||||
fn emit(&self) -> &PersonEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut PersonEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn user_name(&self) -> &str {
|
||||
&self.user_name
|
||||
|
|
|
@ -74,7 +74,7 @@ impl PersonEmitter {
|
|||
|
||||
pub trait PersonTrait {
|
||||
fn new(emit: PersonEmitter) -> Self;
|
||||
fn emit(&self) -> &PersonEmitter;
|
||||
fn emit(&mut self) -> &mut PersonEmitter;
|
||||
fn user_name(&self) -> &str;
|
||||
fn set_user_name(&mut self, value: String);
|
||||
}
|
||||
|
|
|
@ -49,8 +49,8 @@ impl ObjectTrait for Object {
|
|||
string_by_function: String::new()
|
||||
}
|
||||
}
|
||||
fn emit(&self) -> &ObjectEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut ObjectEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn boolean(&self) -> bool {
|
||||
self.boolean
|
||||
|
|
|
@ -250,7 +250,7 @@ impl ObjectEmitter {
|
|||
|
||||
pub trait ObjectTrait {
|
||||
fn new(emit: ObjectEmitter) -> Self;
|
||||
fn emit(&self) -> &ObjectEmitter;
|
||||
fn emit(&mut self) -> &mut ObjectEmitter;
|
||||
fn boolean(&self) -> bool;
|
||||
fn set_boolean(&mut self, value: bool);
|
||||
fn bytearray(&self) -> &[u8];
|
||||
|
|
|
@ -15,8 +15,8 @@ impl GroupTrait for Group {
|
|||
person: person,
|
||||
}
|
||||
}
|
||||
fn emit(&self) -> &GroupEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut GroupEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn person(&self) -> &Person {
|
||||
&self.person
|
||||
|
@ -38,8 +38,8 @@ impl InnerObjectTrait for InnerObject {
|
|||
description: String::new(),
|
||||
}
|
||||
}
|
||||
fn emit(&self) -> &InnerObjectEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut InnerObjectEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn description(&self) -> &str {
|
||||
&self.description
|
||||
|
@ -62,8 +62,8 @@ impl PersonTrait for Person {
|
|||
object: object,
|
||||
}
|
||||
}
|
||||
fn emit(&self) -> &PersonEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut PersonEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn object(&self) -> &InnerObject {
|
||||
&self.object
|
||||
|
|
|
@ -67,7 +67,7 @@ impl GroupEmitter {
|
|||
pub trait GroupTrait {
|
||||
fn new(emit: GroupEmitter,
|
||||
person: Person) -> Self;
|
||||
fn emit(&self) -> &GroupEmitter;
|
||||
fn emit(&mut self) -> &mut GroupEmitter;
|
||||
fn person(&self) -> &Person;
|
||||
fn person_mut(&mut self) -> &mut Person;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ impl InnerObjectEmitter {
|
|||
|
||||
pub trait InnerObjectTrait {
|
||||
fn new(emit: InnerObjectEmitter) -> Self;
|
||||
fn emit(&self) -> &InnerObjectEmitter;
|
||||
fn emit(&mut self) -> &mut InnerObjectEmitter;
|
||||
fn description(&self) -> &str;
|
||||
fn set_description(&mut self, value: String);
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ impl PersonEmitter {
|
|||
pub trait PersonTrait {
|
||||
fn new(emit: PersonEmitter,
|
||||
object: InnerObject) -> Self;
|
||||
fn emit(&self) -> &PersonEmitter;
|
||||
fn emit(&mut self) -> &mut PersonEmitter;
|
||||
fn object(&self) -> &InnerObject;
|
||||
fn object_mut(&mut self) -> &mut InnerObject;
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ impl PersonsTrait for Persons {
|
|||
list: vec![PersonsItem::default(); 10],
|
||||
}
|
||||
}
|
||||
fn emit(&self) -> &PersonsEmitter {
|
||||
&self.emit
|
||||
fn emit(&mut self) -> &mut PersonsEmitter {
|
||||
&mut self.emit
|
||||
}
|
||||
fn row_count(&self, index: Option<usize>) -> usize {
|
||||
self.list.len()
|
||||
|
|
|
@ -177,7 +177,7 @@ impl PersonsTree {
|
|||
|
||||
pub trait PersonsTrait {
|
||||
fn new(emit: PersonsEmitter, model: PersonsTree) -> Self;
|
||||
fn emit(&self) -> &PersonsEmitter;
|
||||
fn emit(&mut self) -> &mut PersonsEmitter;
|
||||
fn row_count(&self, Option<usize>) -> usize;
|
||||
fn can_fetch_more(&self, Option<usize>) -> bool {
|
||||
false
|
||||
|
|
Loading…
Reference in New Issue