Skip to content

Test all messages for all dialects: default and random - #378

Merged
onur-ozkan merged 2 commits into
mavlink:masterfrom
joaoantoniocardoso:test_all_messages
Aug 26, 2025
Merged

Test all messages for all dialects: default and random#378
onur-ozkan merged 2 commits into
mavlink:masterfrom
joaoantoniocardoso:test_all_messages

Conversation

@joaoantoniocardoso

Copy link
Copy Markdown
Contributor

Depends on #377

@joaoantoniocardoso
joaoantoniocardoso force-pushed the test_all_messages branch 3 times, most recently from 2b950b3 to ed7b866 Compare August 22, 2025 20:19
@joaoantoniocardoso
joaoantoniocardoso marked this pull request as ready for review August 22, 2025 20:20
Comment thread mavlink-core/src/lib.rs Outdated
Comment on lines +147 to +151
pub trait MavlinkDialect {
/// All messages IDs
const MESSAGE_IDS: &'static [u32];
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like isn't useful for users. Maybe define it for tests only?

@joaoantoniocardoso joaoantoniocardoso Aug 24, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe put this behind some other feature? Once I was trying to implement runtime dialect recognition (like what mavp2p does), and this was something I was missing... And although not precisely what was asked, check #291.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, so it is useful in some cases. Wouldn't it be better to provide this information under impl MavMessage instead? A function like const fn all_ids(&self) -> &'static [u32] would be more accessible to users since they could see it directly on MavMessage without needing to know about/import the *Dialect types. It should be less complexity to maintain as well since we don't have to introduce new trait and types.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I'll try that, thanks!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, but it looks like GitHub Actions is unstable now and failing to test it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, now it's back working again

@joaoantoniocardoso
joaoantoniocardoso force-pushed the test_all_messages branch 3 times, most recently from aed3b8e to c1d691d Compare August 25, 2025 21:18
Comment thread mavlink-core/src/lib.rs Outdated
Comment on lines +106 to +116
/// A MAVLink dialect metadata
///
/// Each message sets `MavMessage` enum implements this trait. The [`Dialect`] trait is used to
/// represent dialects in an abstract way.
pub trait Dialect
where
Self: Sized,
{
/// All dialect's messages IDs
const MESSAGE_IDS: &'static [u32];
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I wasn't clear. What I meant was writing a const fn for each MavMessage, like:

impl MavMessage {
    const fn all_ids(&self) -> &'static [u32] {
        ...
    }
}

without introducing any additional types or variables.

@onur-ozkan onur-ozkan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@onur-ozkan
onur-ozkan merged commit e81b23b into mavlink:master Aug 26, 2025
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants