Struct dicom_core::header::Length
source · 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§
source§impl Length
impl Length
source§impl Length
impl Length
sourcepub fn is_undefined(self) -> bool
pub fn is_undefined(self) -> bool
Check whether this length is undefined (unknown).
sourcepub fn is_defined(self) -> bool
pub fn is_defined(self) -> bool
Check whether this length is well defined (not undefined).
Trait Implementations§
source§impl PartialOrd<Length> for Length
impl PartialOrd<Length> for Length
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moresource§impl SubAssign<Length> for Length
impl SubAssign<Length> for Length
source§fn sub_assign(&mut self, rhs: Length)
fn sub_assign(&mut self, rhs: Length)
Performs the
-= operation. Read moresource§impl SubAssign<i32> for Length
impl SubAssign<i32> for Length
source§fn sub_assign(&mut self, rhs: i32)
fn sub_assign(&mut self, rhs: i32)
Performs the
-= operation. Read more