mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Previously, the devtools code was structured like this (in pseudocode): ```rust fn run() { let member_1; let member_2; fn foo(&member_1) { // ... } fn bar(&member_1, &member_2) { // ... } loop { match get_message() { Message1 => foo(&member_1), Message2 => bar(&member_1, &member_2), } } } ``` This is not very idiomatic rust. And, more importantly, it makes it hard to edit this code with an IDE, because "find all references" and similar actions don't properly work. (member_1 inside "foo" is a different variable than member_1 inside "bar" or "run"). Instead, the code is now structured (roughly) like this: ```rust struct DevtoolsInstance { member_1, member_2, } impl DevtoolsInstance { fn foo(&self) { // ... } fn bar(&self) { // ... } fn run(&self) { loop { match get_message() { Message1 => self.foo(), Message2 => self.bar(), } } } } ``` In my opinion, this is an improvement and should make future additions to the devtools server easier. No behaviour change is intended. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> |
||
---|---|---|
.. | ||
actors | ||
actor.rs | ||
build.rs | ||
Cargo.toml | ||
lib.rs | ||
protocol.rs |