[−][src]Struct dicom_core::header::Length
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));
Methods
impl Length[src]
pub const UNDEFINED: Self[src]
A length that is undefined.
pub fn new(len: u32) -> Self[src]
Create a new length value from its internal representation.
This is equivalent to Length(len).
pub fn defined(len: u32) -> Self[src]
Create a new length value with the given number of bytes.
Panic
This function will panic if len represents an undefined length.
impl Length[src]
pub fn is_undefined(self) -> bool[src]
Check whether this length is undefined.
pub fn is_defined(self) -> bool[src]
Check whether this length is well defined (not undefined).
pub fn get(self) -> Option<u32>[src]
Fetch the concrete length value, if available.
Returns None if it represents an undefined length.
Trait Implementations
impl From<u32> for Length[src]
impl PartialOrd<Length> for Length[src]
fn partial_cmp(&self, rhs: &Length) -> Option<Ordering>[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool1.0.0[src]
This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool1.0.0[src]
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
#[must_use]
fn gt(&self, other: &Rhs) -> bool1.0.0[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool1.0.0[src]
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
impl PartialEq<Length> for Length[src]
fn eq(&self, rhs: &Length) -> bool[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
This method tests for !=.
impl Clone for Length[src]
fn clone(&self) -> Length[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Copy for Length[src]
impl Display for Length[src]
impl Debug for Length[src]
impl Add<Length> for Length[src]
type Output = Self
The resulting type after applying the + operator.
fn add(self, rhs: Length) -> Self::Output[src]
impl Add<i32> for Length[src]
type Output = Self
The resulting type after applying the + operator.
fn add(self, rhs: i32) -> Self::Output[src]
impl Sub<Length> for Length[src]
type Output = Self
The resulting type after applying the - operator.
fn sub(self, rhs: Length) -> Self::Output[src]
impl Sub<i32> for Length[src]
Auto Trait Implementations
impl Send for Length
impl Unpin for Length
impl Sync for Length
impl UnwindSafe for Length
impl RefUnwindSafe for Length
Blanket Implementations
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,