Expand description
Annotating wrapper around storage objects.
Wraps other storage objects, adding an arbitrary tag to them.
This may be useful when using the “mapping” interface, to identify the storage objects returned in raw mappings.
Example:
const TEST_TAG: u32 = 42;
let disk_size = 16 << 30;
let test_offset = 1 << 30;
let inner_storage = Null::new(disk_size);
let annotated_storage = Annotated::new(inner_storage, TEST_TAG);
let image = Raw::open_image(annotated_storage, false).await?;
let image = FormatAccess::new(image);
let mapping = image.get_mapping(test_offset, 1).await?.0;
let Mapping::Raw {
storage, offset, ..
} = mapping
else {
panic!("Raw mapping expected");
};
assert_eq!(*storage.tag(), TEST_TAG);
assert_eq!(offset, test_offset);
Structs§
- Annotated
- Annotating wrapper around storage objects.