Struct dicom_parser::stateful::encode::StatefulEncoder
source · [−]pub struct StatefulEncoder<W, E, T = SpecificCharacterSet> { /* private fields */ }
Expand description
Also called a printer, this encoder type provides a stateful mid-level
abstraction for writing DICOM content. Unlike Encode
,
the stateful encoder knows how to write text values and keeps track
of how many bytes were written.
W
is the write target, E
is the encoder, and T
is the text codec.
Implementations
sourceimpl<W, E, T> StatefulEncoder<W, E, T>
impl<W, E, T> StatefulEncoder<W, E, T>
sourceimpl<'s> StatefulEncoder<Box<dyn Write + 'w, Global>, Box<dyn EncodeTo<dyn Write + 'static> + 'w, Global>, SpecificCharacterSet>
impl<'s> StatefulEncoder<Box<dyn Write + 'w, Global>, Box<dyn EncodeTo<dyn Write + 'static> + 'w, Global>, SpecificCharacterSet>
pub fn from_transfer_syntax(
to: Box<dyn Write + 's>,
ts: TransferSyntax,
charset: SpecificCharacterSet
) -> Result<Self>
sourceimpl<W, E> StatefulEncoder<W, E> where
W: Write,
E: EncodeTo<W>,
impl<W, E> StatefulEncoder<W, E> where
W: Write,
E: EncodeTo<W>,
sourcepub fn encode_element_header(&mut self, de: DataElementHeader) -> Result<()>
pub fn encode_element_header(&mut self, de: DataElementHeader) -> Result<()>
Encode and write a data element header.
sourcepub fn encode_item_header(&mut self, len: u32) -> Result<()>
pub fn encode_item_header(&mut self, len: u32) -> Result<()>
Encode and write an item header,
where len
is the specified length of the item
(can be 0xFFFF_FFFF
for undefined length).
sourcepub fn encode_item_delimiter(&mut self) -> Result<()>
pub fn encode_item_delimiter(&mut self) -> Result<()>
Encode and write an item delimiter.
sourcepub fn encode_sequence_delimiter(&mut self) -> Result<()>
pub fn encode_sequence_delimiter(&mut self) -> Result<()>
Encode and write a sequence delimiter.
sourcepub fn write_raw_bytes(&mut self, bytes: &[u8]) -> Result<()>
pub fn write_raw_bytes(&mut self, bytes: &[u8]) -> Result<()>
Write the given bytes directly to the inner writer.
Note that this method
(unlike write_bytes
)
does not perform any additional padding.
sourcepub fn write_bytes(&mut self, bytes: &[u8]) -> Result<()>
pub fn write_bytes(&mut self, bytes: &[u8]) -> Result<()>
Write a primitive DICOM value as a bunch of bytes directly to the inner writer.
This method will perform the necessary padding (always with zeros) to ensure that the encoded value has an even number of bytes.
sourcepub fn bytes_written(&self) -> u64
pub fn bytes_written(&self) -> u64
Retrieve the number of bytes written so far by this printer.
sourcepub fn encode_offset_table(&mut self, table: &[u32]) -> Result<()>
pub fn encode_offset_table(&mut self, table: &[u32]) -> Result<()>
Encode and write the values of a pixel data offset table.
sourcepub fn encode_primitive_element(
&mut self,
de: &DataElementHeader,
value: &PrimitiveValue
) -> Result<()>
pub fn encode_primitive_element(
&mut self,
de: &DataElementHeader,
value: &PrimitiveValue
) -> Result<()>
Encode and write a data element with a primitive value.
This method will perform the necessary padding to ensure that the encoded value is an even number of bytes. Where applicable, this will use the inner text codec for textual values. The length property of the header is ignored, the true byte length of the value in its encoded form is used instead.
sourcepub fn encode_primitive(
&mut self,
de: &DataElementHeader,
value: &PrimitiveValue
) -> Result<()>
👎 Deprecated since 0.5.0: use encode_primitive_element
instead
pub fn encode_primitive(
&mut self,
de: &DataElementHeader,
value: &PrimitiveValue
) -> Result<()>
use encode_primitive_element
instead
Encode and write a primitive value.
Its use is not recommended because the encoded value’s real length might not match the header’s length, leading to an inconsistent data set.
Trait Implementations
Auto Trait Implementations
impl<W, E, T> RefUnwindSafe for StatefulEncoder<W, E, T> where
E: RefUnwindSafe,
T: RefUnwindSafe,
W: RefUnwindSafe,
impl<W, E, T> Send for StatefulEncoder<W, E, T> where
E: Send,
T: Send,
W: Send,
impl<W, E, T> Sync for StatefulEncoder<W, E, T> where
E: Sync,
T: Sync,
W: Sync,
impl<W, E, T> Unpin for StatefulEncoder<W, E, T> where
E: Unpin,
T: Unpin,
W: Unpin,
impl<W, E, T> UnwindSafe for StatefulEncoder<W, E, T> where
E: UnwindSafe,
T: UnwindSafe,
W: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more