dicom_encoding::encode

Trait Encode

Source
pub trait Encode {
    // Required methods
    fn encode_tag<W>(&self, to: W, tag: Tag) -> Result<()>
       where W: Write;
    fn encode_element_header<W>(
        &self,
        to: W,
        de: DataElementHeader,
    ) -> Result<usize>
       where W: Write;
    fn encode_item_header<W>(&self, to: W, len: u32) -> Result<()>
       where W: Write;
    fn encode_primitive<W>(
        &self,
        to: W,
        value: &PrimitiveValue,
    ) -> Result<usize>
       where W: Write;
    fn encode_offset_table<W>(
        &self,
        to: W,
        offset_table: &[u32],
    ) -> Result<usize>
       where W: Write;

    // Provided methods
    fn encode_item_delimiter<W>(&self, to: W) -> Result<()>
       where W: Write { ... }
    fn encode_sequence_delimiter<W>(&self, to: W) -> Result<()>
       where W: Write { ... }
}
Expand description

Type trait for a data element encoder.

Required Methods§

Source

fn encode_tag<W>(&self, to: W, tag: Tag) -> Result<()>
where W: Write,

Encode and write an element tag.

Source

fn encode_element_header<W>( &self, to: W, de: DataElementHeader, ) -> Result<usize>
where W: Write,

Encode and write a data element header to the given destination. Returns the number of bytes effectively written on success.

Source

fn encode_item_header<W>(&self, to: W, len: u32) -> Result<()>
where W: Write,

Encode and write a DICOM sequence item header to the given destination.

Source

fn encode_primitive<W>(&self, to: W, value: &PrimitiveValue) -> Result<usize>
where W: Write,

Encode and write a primitive DICOM value to the given destination.

Source

fn encode_offset_table<W>(&self, to: W, offset_table: &[u32]) -> Result<usize>
where W: Write,

Encode and write a DICOM pixel data offset table to the given destination.

For convenience, returns the number of bytes written on success, equivalent to offset_table.len() * 4.

Provided Methods§

Source

fn encode_item_delimiter<W>(&self, to: W) -> Result<()>
where W: Write,

Encode and write a DICOM sequence item delimiter to the given destination.

Source

fn encode_sequence_delimiter<W>(&self, to: W) -> Result<()>
where W: Write,

Encode and write a DICOM sequence delimiter to the given destination.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> Encode for &T
where T: Encode + ?Sized,

Source§

fn encode_tag<W>(&self, to: W, tag: Tag) -> Result<()>
where W: Write,

Source§

fn encode_element_header<W>( &self, to: W, de: DataElementHeader, ) -> Result<usize>
where W: Write,

Source§

fn encode_item_header<W>(&self, to: W, len: u32) -> Result<()>
where W: Write,

Source§

fn encode_item_delimiter<W>(&self, to: W) -> Result<()>
where W: Write,

Source§

fn encode_sequence_delimiter<W>(&self, to: W) -> Result<()>
where W: Write,

Source§

fn encode_primitive<W>(&self, to: W, value: &PrimitiveValue) -> Result<usize>
where W: Write,

Source§

fn encode_offset_table<W>(&self, to: W, offset_table: &[u32]) -> Result<usize>
where W: Write,

Source§

impl<T> Encode for Box<T>
where T: Encode + ?Sized,

Source§

fn encode_tag<W>(&self, to: W, tag: Tag) -> Result<()>
where W: Write,

Source§

fn encode_element_header<W>( &self, to: W, de: DataElementHeader, ) -> Result<usize>
where W: Write,

Source§

fn encode_item_header<W>(&self, to: W, len: u32) -> Result<()>
where W: Write,

Source§

fn encode_item_delimiter<W>(&self, to: W) -> Result<()>
where W: Write,

Source§

fn encode_sequence_delimiter<W>(&self, to: W) -> Result<()>
where W: Write,

Source§

fn encode_primitive<W>(&self, to: W, value: &PrimitiveValue) -> Result<usize>
where W: Write,

Source§

fn encode_offset_table<W>(&self, to: W, offset_table: &[u32]) -> Result<usize>
where W: Write,

Implementors§