dicom_encoding::encode

Trait EncodeTo

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

Type trait for a data element encoder to a single known writer type W.

Required Methods§

Source

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

Encode and write an element tag.

Source

fn encode_element_header( &self, to: &mut 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.

Note that data element header should be encoded as is, regardless of the given value length. Any eventual padding logic should be done at a higher level.

Source

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

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

Source

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

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

Source

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

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

Source

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

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

Source

fn encode_offset_table(&self, to: &mut 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.

Implementations on Foreign Types§

Source§

impl<T, W: ?Sized> EncodeTo<W> for &T
where T: EncodeTo<W>,

Source§

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

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Implementors§

Source§

impl<T, W> EncodeTo<W> for EncoderFor<T, W>
where T: Encode, W: Write + ?Sized,