Skip to content

Commit 66ff347

Browse files
committed
refactor: use matches! instead of to_string() for tests
Some tests that were explicitly testing for error conditions used converted errors to strings to determine whether two errors are the same (by saying they're only the same if their string representation was identical). Replace this with more roboust assertions on `matches!`. Signed-off-by: Patrick Roy <[email protected]>
1 parent ebf2ae9 commit 66ff347

File tree

7 files changed

+261
-355
lines changed

7 files changed

+261
-355
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
`write_volatile_to` and `write_all_volatile_to` functions from the `GuestMemory` trait to the `Bytes` trait.
1515
- \[[#312](https://github.com/rust-vmm/vm-memory/pull/312)\]: Give `GuestMemory::find_region` and `GuestMemory::num_regions`
1616
a default implementation, based on linear search.
17+
- \[[#312](https://github.com/rust-vmm/vm-memory/pull/312)\]: Provide a marker trait, `GuestMemoryRegionBytes`, which enables a default implementation of `Bytes<MemoryRegionAddress>`
18+
for a `GuestMemoryRegion` if implemented.
1719

1820
- \[#324](https:////github.com/rust-vmm/vm-memory/pull/324)\] `GuestMemoryRegion::bitmap()` now returns a `BitmapSlice`. Accessing the full bitmap is now possible only if the type of the memory region is know, for example with `MmapRegion::bitmap()`.
1921

src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ pub use guest_memory::{
5151
};
5252

5353
pub mod region;
54-
pub use region::{GuestMemoryRegion, GuestRegionCollection, GuestRegionError as Error};
54+
pub use region::{
55+
GuestMemoryRegion, GuestMemoryRegionBytes, GuestRegionCollection, GuestRegionError as Error,
56+
};
5557

5658
pub mod io;
5759
pub use io::{ReadVolatile, WriteVolatile};

0 commit comments

Comments
 (0)