Enum dicom_encoding::transfer_syntax::Codec

source ·
pub enum Codec<D, R, W> {
    None,
    EncapsulatedPixelData(Option<R>, Option<W>),
    Dataset(Option<D>),
}
Expand description

A description and possible implementation regarding the encoding and decoding requirements of a transfer syntax. This is also used as a means to describe whether pixel data is encapsulated and whether this implementation supports decoding and/or encoding it.

§Type parameters

  • D should implement DataRWAdapter and defines how one should read and write DICOM data sets, such as in the case for deflated data. When no special considerations for data set reading and writing are necessary, this can be set to NeverAdapter.
  • R should implement PixelDataReader, and enables programs to convert encapsulated pixel data fragments into native pixel data.
  • W should implement PixelDataWriter, and enables programs to convert native pixel data into encapsulated pixel data.

Variants§

§

None

No codec is required for this transfer syntax.

Pixel data, if any, should be in its native, unencapsulated format.

§

EncapsulatedPixelData(Option<R>, Option<W>)

Pixel data for this transfer syntax is encapsulated and likely subjected to a specific encoding process. The first part of the tuple struct contains the pixel data decoder, whereas the second item is for the pixel data encoder.

Decoding of the pixel data is not supported if the decoder is None. In this case, the program should still be able to parse DICOM data sets and fetch the pixel data in its encapsulated form.

§

Dataset(Option<D>)

A custom data set codec is required for reading and writing data sets.

If the item in the tuple struct is None, then no reading and writing whatsoever is supported. This could be used by a stub of Deflated Explicit VR Little Endian, for example.

Trait Implementations§

source§

impl<D: Clone, R: Clone, W: Clone> Clone for Codec<D, R, W>

source§

fn clone(&self) -> Codec<D, R, W>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<D: Debug, R: Debug, W: Debug> Debug for Codec<D, R, W>

source§

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

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

impl<D: PartialEq, R: PartialEq, W: PartialEq> PartialEq for Codec<D, R, W>

source§

fn eq(&self, other: &Codec<D, R, W>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<D, R, W> StructuralPartialEq for Codec<D, R, W>

Auto Trait Implementations§

§

impl<D, R, W> Freeze for Codec<D, R, W>
where R: Freeze, W: Freeze, D: Freeze,

§

impl<D, R, W> RefUnwindSafe for Codec<D, R, W>

§

impl<D, R, W> Send for Codec<D, R, W>
where R: Send, W: Send, D: Send,

§

impl<D, R, W> Sync for Codec<D, R, W>
where R: Sync, W: Sync, D: Sync,

§

impl<D, R, W> Unpin for Codec<D, R, W>
where R: Unpin, W: Unpin, D: Unpin,

§

impl<D, R, W> UnwindSafe for Codec<D, R, W>
where R: UnwindSafe, W: UnwindSafe, D: UnwindSafe,

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> 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

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

§

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.