Skip to main content

UuidInfo

Struct UuidInfo 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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: u8

VERS 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

Source

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"));

Trait Implementations§

Source§

impl Clone for UuidInfo

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UuidInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for UuidInfo

Source§

impl PartialEq for UuidInfo

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for UuidInfo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.