-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add speed setter and getter #2
Conversation
Signed-off-by: Albert Esteve <[email protected]>
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.
LGTM.
Some comments might be due to lack of familiarity with the code :)
Signed-off-by: Albert Esteve <[email protected]>
Signed-off-by: Albert Esteve <[email protected]>
Signed-off-by: Albert Esteve <[email protected]>
36c1e42
to
774e0a9
Compare
Thanks @barpavel ! |
} | ||
} | ||
} | ||
|
||
impl GetPropertyValue for EmulatorMessage { | ||
fn get_value(&self) -> Result<VehiclePropertyValue> { | ||
if self.value.len() != 1 { |
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.
If it can't be zero, maybe better change to >1
.
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.
No, the only valid value is 1. With >1
it would allow empty vectors.
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.
No, you misunderstood me.
I meant the following:
!=1
means either 0 or more than 1 (2, 3, ...).
If zero values is possible, then returning ReceiveMessageTooManyValuesError
is confusing.
If zero of values is not possible, then changing !=1
into >1
is the same, but more readable.
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.
But never mind, this is not that important, just explaining myself :)
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.
Ah! gotcha. Well, at least the size of the values vector is printed with the error :D
Ahhh, already merged, all good :) |
Add setter and getter for gear and speed (and display_speed).