-
Notifications
You must be signed in to change notification settings - Fork 46
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
feat(orb-mcu-util): print new diamond evt version #381
Conversation
d750940
to
6b84d83
Compare
if self.0.version | ||
<= orb_messages::hardware::OrbVersion::HwVersionPearlEv5 as i32 | ||
{ | ||
write!(f, "EVT{:?}", self.0.version) |
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.
write!(f, "EVT{:?}", self.0.version) | |
write!(f, "Pearl EV{:?}", self.0.version) |
I'd prefer verbose unless any tools depend on it
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.
i would prefer too but indeed, this would break things
also print 'Diamond_unknown' in case binary doesn't support any new version
6b84d83
to
dec8a5e
Compare
fn from_version_i32(value: i32) -> Self; | ||
} | ||
impl OrbVersionFromInt for orb_messages::hardware::OrbVersion { | ||
fn from_version_i32(value: i32) -> 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.
fn from_version_i32(value: i32) -> Self { | |
const fn from_version_i32(value: i32) -> 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.
interesting... is this const
a new thing?
what does it bring?
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.
its like constexpr in c++ - evaluation is done at compile-time. Const functions have been around for a long time (possibly since 1.0?). But they are more useful nowadays, and especially after the inline_const
feature was stabilized last year: rust-lang/rust#104087.
const
mostly gets used in places where assignment to a const
or a static
variable is necessary.
also print 'Diamond_unknown' in case binary doesn't support any new version