feat(overlay): add read-only DT overlay inspection capabilities#57
feat(overlay): add read-only DT overlay inspection capabilities#57m4tx wants to merge 4 commits into
Conversation
| default = [] | ||
| alloc = [] | ||
| arrayvec07 = ["dep:arrayvec"] | ||
| overlay = ["write"] |
There was a problem hiding this comment.
Why does read-only inspection of an overlay require the write feature, and hence alloc?
There was a problem hiding this comment.
Actually for that matter, why does it need a separate feature at all? It doesn't add any extra dependencies, so why not enable it always?
There was a problem hiding this comment.
For now, at least alloc is needed for the use of String to provide more useful errors. The actual feature of applying overlays (in #60) is implemented for DeviceTree only (for now), so it's a bit forward-looking - but the point is, in the final form, write will be needed anyways. I can change this to alloc in this PR, though.
| //! overlay inspection works uniformly across both read-only (`FdtNode`) and | ||
| //! in-memory (`DeviceTreeNode`) representations. | ||
|
|
||
| #![allow(unused)] |
There was a problem hiding this comment.
Ah, sorry - I should've made it clear that this is part of a bigger chain that is split to make the reviewing a bit easier (maybe eventually we'll get stacked PRs in GitHub, but for this needs to do). This read only part is later used in #60.
|
|
||
| /// An error that can occur when inspecting or applying a device tree overlay. | ||
| #[derive(Debug, Clone, PartialEq, Eq, Hash, Error)] | ||
| #[cfg(feature = "write")] |
There was a problem hiding this comment.
Why write rather than overlay?
There was a problem hiding this comment.
Good catch - yes, this should be overlay.
|
|
||
| /// Typed wrapper for a device tree overlay root node. | ||
| #[derive(Debug, Clone, Copy)] | ||
| pub(crate) struct Overlay<N> { |
There was a problem hiding this comment.
Is there any reason why this shouldn't be public? I guess it's not super common, but someone might want to use this crate to display an overlay in some sort of debug UI or something.
There was a problem hiding this comment.
Well, the main reason could be that we promise some API that people might start relying on, on later on we might change or remove it. If you think it could be useful, though, I guess it's fine to make it public.
No description provided.