Skip to content

Commit 9e54f63

Browse files
committed
multiboot2: iterator fix (0.15.1)
1 parent 2e72979 commit 9e54f63

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

multiboot2/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Multiboot2-compliant bootloaders, like GRUB. It supports all tags from the speci
66
including full support for the sections of ELF-64. This library is `no_std` and can be
77
used in a Multiboot2-kernel.
88
"""
9-
version = "0.15.0"
9+
version = "0.15.1"
1010
authors = [
1111
"Philipp Oppermann <[email protected]>",
1212
"Calvin Lee <[email protected]>",

multiboot2/Changelog.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# CHANGELOG for crate `multiboot2`
22

3+
## 0.15.1 (2023-03-18)
4+
- **BREAKING** `MemoryMapTag::all_memory_areas` was renamed to `memory_areas`
5+
and now returns `MemoryAreaIter` instead of
6+
`impl Iterator<Item = &MemoryArea>`. Experience showed that its better to
7+
return the specific iterator whenever possible.
8+
- **BREAKING** `MemoryMapTag::memory_areas` was renamed to
9+
`available_memory_areas`
10+
(_Sorry for the breaking changes in a minor release, but I just stumbled upon
11+
this und since the last breaking release was just yesterday, users have to
12+
deal with changes anyway._)
13+
314
## 0.15.0 (2023-03-17)
415
- **BREAKING** MSRV is 1.56.1
516
- **BREAKING** fixed lifetime issues: `VBEInfoTag` is no longer `&static`

multiboot2/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ mod tests {
12571257
assert_eq!(ElfSectionFlags::empty(), s8.flags());
12581258
assert_eq!(ElfSectionType::StringTable, s8.section_type());
12591259
assert!(s.next().is_none());
1260-
let mut mm = bi.memory_map_tag().unwrap().memory_areas();
1260+
let mut mm = bi.memory_map_tag().unwrap().available_memory_areas();
12611261
let mm1 = mm.next().unwrap();
12621262
assert_eq!(0x00000000, mm1.start_address());
12631263
assert_eq!(0x009_FC00, mm1.end_address());

multiboot2/src/memory_map.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ pub struct MemoryMapTag {
2222
}
2323

2424
impl MemoryMapTag {
25-
/// Return an iterator over all AVAILABLE marked memory areas.
26-
pub fn memory_areas(&self) -> impl Iterator<Item = &MemoryArea> {
27-
self.all_memory_areas()
25+
/// Return an iterator over all memory areas that have the type
26+
/// [`MemoryAreaType::Available`].
27+
pub fn available_memory_areas(&self) -> impl Iterator<Item = &MemoryArea> {
28+
self.memory_areas()
2829
.filter(|entry| matches!(entry.typ, MemoryAreaType::Available))
2930
}
3031

31-
/// Return an iterator over all marked memory areas.
32-
pub fn all_memory_areas(&self) -> impl Iterator<Item = &MemoryArea> {
32+
/// Return an iterator over all memory areas.
33+
pub fn memory_areas(&self) -> MemoryAreaIter {
3334
let self_ptr = self as *const MemoryMapTag;
3435
let start_area = self.first_area.as_ptr();
3536

0 commit comments

Comments
 (0)