Skip to content

Commit 310b103

Browse files
authored
Merge pull request #146 from rust-osdev/dev4
tree-wide: rename builder structs (remove Multiboot2 prefix)
2 parents ef79b8b + 5fdd8ae commit 310b103

File tree

9 files changed

+28
-27
lines changed

9 files changed

+28
-27
lines changed

multiboot2-header/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- added the optional `unstable` feature (requires nightly)
77
- implement `core::error::Error` for `LoadError`
88
- depends on `[email protected]`
9+
- **BREAKING** renamed `Multiboot2HeaderBuilder` to `HeaderBuilder`
910

1011
## 0.2.0 (2022-05-03)
1112
- **BREAKING** renamed `EntryHeaderTag` to `EntryAddressHeaderTag`

multiboot2-header/examples/minimal.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use multiboot2_header::builder::{InformationRequestHeaderTagBuilder, Multiboot2HeaderBuilder};
1+
use multiboot2_header::builder::{HeaderBuilder, InformationRequestHeaderTagBuilder};
22
use multiboot2_header::{
33
HeaderTagFlag, HeaderTagISA, MbiTagType, Multiboot2Header, RelocatableHeaderTag,
44
RelocatableHeaderTagPreference,
@@ -8,7 +8,7 @@ use multiboot2_header::{
88
fn main() {
99
// We create a Multiboot2 header during runtime here. A practical example is that your
1010
// program gets the header from a file and parses it afterwards.
11-
let mb2_hdr_bytes = Multiboot2HeaderBuilder::new(HeaderTagISA::I386)
11+
let mb2_hdr_bytes = HeaderBuilder::new(HeaderTagISA::I386)
1212
.relocatable_tag(RelocatableHeaderTag::new(
1313
HeaderTagFlag::Required,
1414
0x1337,

multiboot2-header/src/builder/header.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Exports item [`Multiboot2HeaderBuilder`].
1+
//! Exports item [`HeaderBuilder`].
22
33
use crate::builder::information_request::InformationRequestHeaderTagBuilder;
44
use crate::builder::traits::StructAsBytes;
@@ -15,7 +15,7 @@ use core::mem::size_of;
1515
/// The tags will appear in the order of their corresponding enumeration,
1616
/// except for the END tag.
1717
#[derive(Clone, Debug, PartialEq, Eq)]
18-
pub struct Multiboot2HeaderBuilder {
18+
pub struct HeaderBuilder {
1919
arch: HeaderTagISA,
2020
// first
2121
information_request_tag: Option<InformationRequestHeaderTagBuilder>,
@@ -39,7 +39,7 @@ pub struct Multiboot2HeaderBuilder {
3939
relocatable_tag: Option<RelocatableHeaderTag>,
4040
}
4141

42-
impl Multiboot2HeaderBuilder {
42+
impl HeaderBuilder {
4343
pub const fn new(arch: HeaderTagISA) -> Self {
4444
Self {
4545
arch,
@@ -228,7 +228,7 @@ impl Multiboot2HeaderBuilder {
228228

229229
#[cfg(test)]
230230
mod tests {
231-
use crate::builder::header::Multiboot2HeaderBuilder;
231+
use crate::builder::header::HeaderBuilder;
232232
use crate::builder::information_request::InformationRequestHeaderTagBuilder;
233233
use crate::{
234234
HeaderTagFlag, HeaderTagISA, MbiTagType, Multiboot2Header, RelocatableHeaderTag,
@@ -237,15 +237,15 @@ mod tests {
237237

238238
#[test]
239239
fn test_size_or_up_aligned() {
240-
assert_eq!(0, Multiboot2HeaderBuilder::size_or_up_aligned(0));
241-
assert_eq!(8, Multiboot2HeaderBuilder::size_or_up_aligned(1));
242-
assert_eq!(8, Multiboot2HeaderBuilder::size_or_up_aligned(8));
243-
assert_eq!(16, Multiboot2HeaderBuilder::size_or_up_aligned(9));
240+
assert_eq!(0, HeaderBuilder::size_or_up_aligned(0));
241+
assert_eq!(8, HeaderBuilder::size_or_up_aligned(1));
242+
assert_eq!(8, HeaderBuilder::size_or_up_aligned(8));
243+
assert_eq!(16, HeaderBuilder::size_or_up_aligned(9));
244244
}
245245

246246
#[test]
247247
fn test_builder() {
248-
let builder = Multiboot2HeaderBuilder::new(HeaderTagISA::I386);
248+
let builder = HeaderBuilder::new(HeaderTagISA::I386);
249249
// Multiboot2 basic header + end tag
250250
let mut expected_len = 16 + 8;
251251
assert_eq!(builder.expected_len(), expected_len);

multiboot2-header/src/builder/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ mod header;
44
mod information_request;
55
pub(self) mod traits;
66

7-
pub use header::Multiboot2HeaderBuilder;
7+
pub use header::HeaderBuilder;
88
pub use information_request::InformationRequestHeaderTagBuilder;

multiboot2-header/src/header.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub const MULTIBOOT2_HEADER_MAGIC: u32 = 0xe85250d6;
1616
/// by all tags (see [`crate::tags::HeaderTagType`]).
1717
/// Use this if you get a pointer to the header and just want
1818
/// to parse it. If you want to construct the type by yourself,
19-
/// please look at [`crate::builder::Multiboot2HeaderBuilder`].
19+
/// please look at [`crate::builder::HeaderBuilder`].
2020
#[repr(transparent)]
2121
pub struct Multiboot2Header<'a> {
2222
inner: &'a Multiboot2BasicHeader,

multiboot2-header/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
//!
44
//! # Example
55
//! ```rust
6-
//! use multiboot2_header::builder::{InformationRequestHeaderTagBuilder, Multiboot2HeaderBuilder};
6+
//! use multiboot2_header::builder::{InformationRequestHeaderTagBuilder, HeaderBuilder};
77
//! use multiboot2_header::{HeaderTagFlag, HeaderTagISA, MbiTagType, RelocatableHeaderTag, RelocatableHeaderTagPreference, Multiboot2Header};
88
//!
99
//! // Small example that creates a Multiboot2 header and parses it afterwards.
1010
//!
1111
//! // We create a Multiboot2 header during runtime here. A practical example is that your
1212
//! // program gets the header from a file and parses it afterwards.
13-
//! let mb2_hdr_bytes = Multiboot2HeaderBuilder::new(HeaderTagISA::I386)
13+
//! let mb2_hdr_bytes = HeaderBuilder::new(HeaderTagISA::I386)
1414
//! .relocatable_tag(RelocatableHeaderTag::new(
1515
//! HeaderTagFlag::Required,
1616
//! 0x1337,

multiboot2/Changelog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
tags that use DSTs as types. See the example provided in the doc of the
88
`get_tag` method.
99
- renamed `MULTIBOOT2_BOOTLOADER_MAGIC` to `MAGIC`
10-
- added a `builder` feature and a `builder` module with a `Multiboot2InformationBuilder`
11-
struct
10+
- added a `builder` feature and a `builder` module with a
11+
`builder::InformationBuilder` struct
1212
- `EFIMemoryDesc` was removed and is now an alias of
1313
`uefi_raw::table::boot::MemoryDescriptor`
1414
- `EFIMemoryAreaType` was removed and is now an alias of

multiboot2/src/builder/information.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Exports item [`Multiboot2InformationBuilder`].
1+
//! Exports item [`InformationBuilder`].
22
use crate::builder::traits::StructAsBytes;
33
use crate::{
44
BasicMemoryInfoTag, BootInformationInner, BootLoaderNameTag, CommandLineTag,
@@ -16,7 +16,7 @@ use core::mem::size_of;
1616
/// except for the END tag.
1717
#[derive(Debug)]
1818
// #[derive(Debug, PartialEq, Eq)] // wait for uefi-raw 0.3.0
19-
pub struct Multiboot2InformationBuilder {
19+
pub struct InformationBuilder {
2020
basic_memory_info_tag: Option<BasicMemoryInfoTag>,
2121
boot_loader_name_tag: Option<Box<BootLoaderNameTag>>,
2222
command_line_tag: Option<Box<CommandLineTag>>,
@@ -36,7 +36,7 @@ pub struct Multiboot2InformationBuilder {
3636
smbios_tags: Vec<Box<SmbiosTag>>,
3737
}
3838

39-
impl Multiboot2InformationBuilder {
39+
impl InformationBuilder {
4040
pub const fn new() -> Self {
4141
Self {
4242
basic_memory_info_tag: None,
@@ -289,20 +289,20 @@ impl Multiboot2InformationBuilder {
289289

290290
#[cfg(test)]
291291
mod tests {
292-
use crate::builder::information::Multiboot2InformationBuilder;
292+
use crate::builder::information::InformationBuilder;
293293
use crate::{load, BasicMemoryInfoTag, CommandLineTag, ModuleTag};
294294

295295
#[test]
296296
fn test_size_or_up_aligned() {
297-
assert_eq!(0, Multiboot2InformationBuilder::size_or_up_aligned(0));
298-
assert_eq!(8, Multiboot2InformationBuilder::size_or_up_aligned(1));
299-
assert_eq!(8, Multiboot2InformationBuilder::size_or_up_aligned(8));
300-
assert_eq!(16, Multiboot2InformationBuilder::size_or_up_aligned(9));
297+
assert_eq!(0, InformationBuilder::size_or_up_aligned(0));
298+
assert_eq!(8, InformationBuilder::size_or_up_aligned(1));
299+
assert_eq!(8, InformationBuilder::size_or_up_aligned(8));
300+
assert_eq!(16, InformationBuilder::size_or_up_aligned(9));
301301
}
302302

303303
#[test]
304304
fn test_builder() {
305-
let mut builder = Multiboot2InformationBuilder::new();
305+
let mut builder = InformationBuilder::new();
306306
// Multiboot2 basic information + end tag
307307
let mut expected_len = 8 + 8;
308308
assert_eq!(builder.expected_len(), expected_len);

multiboot2/src/builder/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
mod information;
44
pub(crate) mod traits;
55

6-
pub use information::Multiboot2InformationBuilder;
6+
pub use information::InformationBuilder;
77

88
use alloc::alloc::alloc;
99
use alloc::boxed::Box;

0 commit comments

Comments
 (0)