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: u32
Implementations
sourceimpl Length
impl Length
sourceimpl 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
sourceimpl PartialOrd<Length> for Length
impl PartialOrd<Length> for Length
sourcefn partial_cmp(&self, rhs: &Length) -> Option<Ordering>
fn partial_cmp(&self, rhs: &Length) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
sourceimpl SubAssign<Length> for Length
impl SubAssign<Length> for Length
sourcefn sub_assign(&mut self, rhs: Length)
fn sub_assign(&mut self, rhs: Length)
Performs the -=
operation. Read more
sourceimpl SubAssign<i32> for Length
impl SubAssign<i32> for Length
sourcefn sub_assign(&mut self, rhs: i32)
fn sub_assign(&mut self, rhs: i32)
Performs the -=
operation. Read more
impl Copy for Length
Auto Trait Implementations
impl RefUnwindSafe for Length
impl Send for Length
impl Sync for Length
impl Unpin for Length
impl UnwindSafe for Length
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more