Struct dicom_core::header::Length [−][src]
pub struct Length(pub u32);Expand description
A type for representing data set content length, in bytes.
An internal value of 0xFFFF_FFFF represents an undefined
(unspecified) length, which would have to be determined
with a traversal based on the content’s encoding.
This also means that numeric comparisons and arithmetic do not function the same way as primitive number types:
Two length of undefined length are not equal.
assert_ne!(Length::UNDEFINED, Length::UNDEFINED);Any addition or substraction with at least one undefined length results in an undefined length.
assert!((Length::defined(64) + Length::UNDEFINED).is_undefined());
assert!((Length::UNDEFINED + 8).is_undefined());Comparing between at least one undefined length is always false.
assert!(Length::defined(16) < Length::defined(64));
assert!(!(Length::UNDEFINED < Length::defined(64)));
assert!(!(Length::UNDEFINED > Length::defined(64)));
assert!(!(Length::UNDEFINED < Length::UNDEFINED));
assert!(!(Length::UNDEFINED > Length::UNDEFINED));
assert!(!(Length::UNDEFINED <= Length::UNDEFINED));
assert!(!(Length::UNDEFINED >= Length::UNDEFINED));Tuple Fields
0: u32Implementations
Create a new length value from its internal representation.
This is equivalent to Length(len).
Check whether this length is undefined (unknown).
Check whether this length is well defined (not undefined).
Fetch the concrete length value, if available.
Returns None if it represents an undefined length.
Trait Implementations
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
Performs the -= operation. Read more
Performs the -= operation. Read more
Auto Trait Implementations
impl RefUnwindSafe for Length
impl UnwindSafe for Length
Blanket Implementations
Mutably borrows from an owned value. Read more