Skip to content
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

refactor: remove heapless dependency #160

Merged
merged 4 commits into from
May 3, 2023

Conversation

GabrielDertoni
Copy link
Contributor

This PR aims to remove the heapless dependency. Currently the implementation relies on heapless::Vec but doesn't have to. Removing this dependency reduces the ammount of code generated and the compile time. It also uses a const DEFAULT for default values of *_DATA types which can be used in const fns.

Look at #156 for more context.

@patrickelectric
Copy link
Member

@GabrielDertoni please run cargo fmt.

build/parser.rs Outdated Show resolved Hide resolved
build/parser.rs Outdated Show resolved Hide resolved
build/parser.rs Outdated Show resolved Hide resolved
build/parser.rs Outdated Show resolved Hide resolved
Co-authored-by: danieleades <[email protected]>
@patrickelectric
Copy link
Member

@GabrielDertoni check ci

@qwerty19106
Copy link
Contributor

qwerty19106 commented Mar 23, 2023

You can replace serde_arrays dependency on serde-big-array to fix the trait 'Default' is not implemented for '[u8; 200]' problem.

P.S. Maybe the problem is causes by #[serde(default)]. Then it should be replaced on #[serde(default = "path")].

@GabrielDertoni
Copy link
Contributor Author

Yes, it appears to be this #[serde(default)] attribute. And I can't simply have a function for that too. I need to create another trait which is exactly the same as Default, with the exception that it works for arrays of any size.

@patrickelectric
Copy link
Member

It appears fine by be, is there any further comments around this PR ?

@qwerty19106
Copy link
Contributor

It would be nice to add a link to the issue into the RustDefault description.
The best I found is issue.

Default is special, because we already have impl Default for [T; 0] without the T: Default constraint. Rewrite it in const generics requires the const generics specialization, which is far from the stable yet.

@GabrielDertoni
Copy link
Contributor Author

ping @patrickelectric

@patrickelectric patrickelectric merged commit 33edf26 into mavlink:master May 3, 2023
@GabrielDertoni GabrielDertoni deleted the remove-heapless branch May 3, 2023 16:24
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.

4 participants