Introducing CuTimeRange#106
Merged
Merged
Conversation
mik90
approved these changes
Nov 19, 2024
| new_msg.metadata.tov = payload.tov[0].into(); // take the oldest timestamp | ||
|
|
||
| let tov_range = CuTimeRange { | ||
| start: payload.tov[0], |
Collaborator
There was a problem hiding this comment.
Since this is a soa, can we build a CuTimeRange from a slice?
So impl From or TryFrom for CuTimeRange and get CuTimeRange::from(&[T])
Syntactic sugar but still useful
Collaborator
Author
There was a problem hiding this comment.
Added it. It is not used yet but it is a nice thing to have.
| let tov = input.metadata.tov.unwrap(); | ||
| let tov = match input.metadata.tov { | ||
| Tov::Time(single) => single, | ||
| _ => panic!("Unexpected variant"), |
Collaborator
There was a problem hiding this comment.
Is this panicking because nothing should ever continue if this happens?
An early-return with Err would be more configurable for error handling
mik90
reviewed
Nov 19, 2024
| /// Represents a time range. | ||
| #[derive(Clone, Debug, Encode, Decode, Serialize, Deserialize)] | ||
| pub struct CuTimeRange { | ||
| pub start: CuTime, |
Collaborator
There was a problem hiding this comment.
CuTime is Copy, CuTimeRange can be copy too can't it https://doc.rust-lang.org/std/marker/trait.Copy.html#when-can-my-type-be-copy?
Ditto for the partial time range
This would remove the need to do clone() in the task code
This is needed to represent messages that contains more than 1 Tov like several images, several IMU measures etc... We will add helpers like range merging, range intersections etc in a separate PRs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is needed to represent messages that contains more than 1 Tov like several images, several IMU measures etc... We will add helpers like range merging, range intersections etc in a separate PRs.