[][src]Trait dicom_encoding::encode::BasicEncode

pub trait BasicEncode {
    fn endianness(&self) -> Endianness;
fn encode_us<W>(&self, to: W, value: u16) -> Result<()>
    where
        W: Write
;
fn encode_ul<W>(&self, to: W, value: u32) -> Result<()>
    where
        W: Write
;
fn encode_uv<W>(&self, to: W, value: u64) -> Result<()>
    where
        W: Write
;
fn encode_ss<W>(&self, to: W, value: i16) -> Result<()>
    where
        W: Write
;
fn encode_sl<W>(&self, to: W, value: i32) -> Result<()>
    where
        W: Write
;
fn encode_sv<W>(&self, to: W, value: i64) -> Result<()>
    where
        W: Write
;
fn encode_fl<W>(&self, to: W, value: f32) -> Result<()>
    where
        W: Write
;
fn encode_fd<W>(&self, to: W, value: f64) -> Result<()>
    where
        W: Write
; fn with_encoder<T, F1, F2>(&self, f_le: F1, f_be: F2) -> T
    where
        F1: FnOnce(LittleEndianBasicEncoder) -> T,
        F2: FnOnce(BigEndianBasicEncoder) -> T
, { ... }
fn encode_primitive<W>(
        &self,
        to: W,
        value: &PrimitiveValue
    ) -> Result<usize>
    where
        W: Write
, { ... } }

Type trait for an encoder of basic data properties. Unlike Encode (and similar to BasicDecode), this trait is not object safe because it's better to just provide a dynamic implementation.

Required methods

fn endianness(&self) -> Endianness

Retrieve the encoder's endianness.

fn encode_us<W>(&self, to: W, value: u16) -> Result<()> where
    W: Write

Encode an unsigned short value to the given writer.

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

Encode an unsigned long value to the given writer.

fn encode_uv<W>(&self, to: W, value: u64) -> Result<()> where
    W: Write

Encode an unsigned very long value to the given writer.

fn encode_ss<W>(&self, to: W, value: i16) -> Result<()> where
    W: Write

Encode a signed short value to the given writer.

fn encode_sl<W>(&self, to: W, value: i32) -> Result<()> where
    W: Write

Encode a signed long value to the given writer.

fn encode_sv<W>(&self, to: W, value: i64) -> Result<()> where
    W: Write

Encode a signed very long value to the given writer.

fn encode_fl<W>(&self, to: W, value: f32) -> Result<()> where
    W: Write

Encode a single precision float value to the given writer.

fn encode_fd<W>(&self, to: W, value: f64) -> Result<()> where
    W: Write

Encode a double precision float value to the given writer.

Loading content...

Provided methods

fn with_encoder<T, F1, F2>(&self, f_le: F1, f_be: F2) -> T where
    F1: FnOnce(LittleEndianBasicEncoder) -> T,
    F2: FnOnce(BigEndianBasicEncoder) -> T, 

If this encoder is in Little Endian, evaluate the first function. Otherwise, evaluate the second one.

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

Encode a primitive value to the given writer. The default implementation delegates to the other value encoding methods.

Loading content...

Implementors

impl BasicEncode for BasicEncoder[src]

impl BasicEncode for BigEndianBasicEncoder[src]

impl BasicEncode for LittleEndianBasicEncoder[src]

impl BasicEncode for ExplicitVRBigEndianEncoder[src]

impl BasicEncode for ExplicitVRLittleEndianEncoder[src]

impl BasicEncode for ImplicitVRLittleEndianEncoder[src]

impl<T, W: ?Sized> BasicEncode for EncoderFor<T, W> where
    T: BasicEncode,
    W: Write
[src]

Loading content...