pub fn encode_primitive(
        &mut self,
        de: &DataElementHeader,
        value: &PrimitiveValue,
    ) -> Result<()> {
        // intercept string encoding calls to use the text codec
        match value {
            PrimitiveValue::Str(text) => {
                self.encode_text(text, de.vr())?;
                Ok(())
            }
            PrimitiveValue::Strs(texts) => {
                self.encode_texts(&texts[..], de.vr())?;
                Ok(())
            }
            _ => {
                let bytes =
                    self.encoder
                        .encode_primitive(&mut self.to, value)
                        .context(EncodeData {
                            position: self.bytes_written,
                        })?;
                self.bytes_written += bytes as u64;
                Ok(())
            }
        }
    }
/// Encode and write a primitive value. Where applicable, this
/// will use the inner text codec for textual values.
Encode and write a primitive value. Where applicable, this
will use the inner text codec for textual values.
Encode and write a primitive value . Where applicable this will use the inner text codec for textual values .
pub fn encode_primitive(
        &mut self,
        de: &DataElementHeader,
        value: &PrimitiveValue,
    ) -> Result<()> {
        // intercept string encoding calls to use the text codec
        match value {
            PrimitiveValue::Str(text) => {
                self.encode_text(text, de.vr())?;
                Ok(())
            }
            PrimitiveValue::Strs(texts) => {
                self.encode_texts(&texts[..], de.vr())?;
                Ok(())
            }
            _ => {
                let bytes =
                    self.encoder
                        .encode_primitive(&mut self.to, value)
                        .context(EncodeData {
                            position: self.bytes_written,
                        })?;
                self.bytes_written += bytes as u64;
                Ok(())
            }
        }
    }
pub fn encode_primitive ( & mut self , de : & DataElementHeader , value : & PrimitiveValue , ) -> Result < ( ) > { // intercept string encoding calls to use the text codec match value { PrimitiveValue :: Str ( text ) => { self . encode_text ( text , de . vr ( ) ) ? ; Ok ( ( ) ) } PrimitiveValue :: Strs ( texts ) => { self . encode_texts ( & texts [ .. ] , de . vr ( ) ) ? ; Ok ( ( ) ) } _ => { let bytes = self . encoder . encode_primitive ( & mut self . to , value ) . context ( EncodeData { position : self . bytes_written , } ) ? ; self . bytes_written += bytes as u64 ; Ok ( ( ) ) } } }
Encode and write a primitive value.
Encode and write a primitive value .
&mut self
de
&DataElementHeader
value
&PrimitiveValue
&mut self
de
&DataElementHeader
value
&PrimitiveValue