-
Notifications
You must be signed in to change notification settings - Fork 25
Replace element with origin in PointerMove #76
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very good if this is your first shot at Rust!
src/command.rs
Outdated
|
||
impl Parameters for PointerOrigin { | ||
fn from_json(body: &Json) -> WebDriverResult<PointerOrigin> { | ||
match body { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can dereference *body
here to avoid the &Json::String
references below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/command.rs
Outdated
|
||
impl ToJson for PointerOrigin { | ||
fn to_json(&self) -> Json { | ||
match self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here with regards to dereferencing *self
.
src/command.rs
Outdated
fn from_json(body: &Json) -> WebDriverResult<PointerOrigin> { | ||
match body { | ||
&Json::String(ref x) => { | ||
match &*x.to_string() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way to clean up String(ref x)
and the &*x.to_string()
that follows? I'll admit that I resorted to various combinations of ref, & and * until the compiler was happy. Will have to go and read how those actually work at some point.
Reviewed 1 of 1 files at r1. src/command.rs, line 1513 at r1 (raw file): Previously, mjzffr (Maja Frydrychowicz) wrote…
FWIW I prefer using the src/command.rs, line 1515 at r1 (raw file): Previously, mjzffr (Maja Frydrychowicz) wrote…
Right, so. Your original variable is a An When you do the match, writing Does that help at all? I hope it walked the line between patronising and unhelpful… Comments from Reviewable |
Generally I think this looks really good. Review status: 0 of 1 files reviewed at latest revision, 3 unresolved discussions. Comments from Reviewable |
Review status: 0 of 1 files reviewed at latest revision, 3 unresolved discussions. src/command.rs, line 1515 at r1 (raw file): Previously, jgraham wrote…
Yep, that helps. Thanks! src/command.rs, line 1531 at r1 (raw file): Previously, andreastt (Andreas Tolfsen) wrote…
Done. Comments from Reviewable |
Okay, who's the lucky reviewer who wants to help me learn Rust? @jgraham r?
Good: This compiles.
Bad: I haven't been able to test it because I can't compile geckodriver after updating the webdriver dependency to point to my local changes. I think maybe the two are out of sync in many ways.
Anyway, I appreciate the opportunity to write some Rust, and I realize this PR may still need a lot of work.
This change is