#[non_exhaustive]pub struct UuidInfo {
pub ids: Vec<[u8; 16]>,
pub version: u8,
pub flags: [u8; 3],
pub location: Vec<u8>,
}Expand description
A UUID info box (uinf): the UUIDs its UUID list box (ulst) names and
its data entry URL box (url ), which says where more about them can be
found.
A uinf is reported when it is well formed: its contents are whole boxes,
exactly one ulst and exactly one url in either order (other boxes
inside it are ignored), the ulst holds exactly the NU UUIDs its count
gives, and the url holds at least its 4-byte version and flags. A uinf
that breaks any of these is left out of
Jp2Metadata::uuid_info as a whole; the decode goes on. The version,
flags and location are reported as stored, so a version or flags other
than 0 and a location that is not valid UTF-8 or lacks its terminating NUL
are kept.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.ids: Vec<[u8; 16]>The UUIDs from the ulst box (ID0 to ID(NU-1)), in box order.
version: u8VERS from the url box; the standard requires 0.
flags: [u8; 3]FLAG from the url box, as stored (big-endian); the standard
requires 0.
location: Vec<u8>LOC from the url box: the bytes after the version and flags,
verbatim, including any terminating NUL. See
location_str for the URL as text.
Implementations§
Source§impl UuidInfo
impl UuidInfo
Sourcepub fn location_str(&self) -> Option<&str>
pub fn location_str(&self) -> Option<&str>
The location as a UTF-8 string, without its terminating NUL: None
when the bytes are not valid UTF-8 or hold a NUL before the last byte.
A location with no terminating NUL is read to its end.
use rust_j2k::read_header;
let bytes = jp2_with_uuid_info(&codestream)?;
let jp2 = read_header(&bytes)?.jp2.expect("a JP2 file");
let info = &jp2.uuid_info[0];
assert_eq!(info.ids, [[0x42; 16]]);
assert_eq!(info.location_str(), Some("https://example.com/ids"));