pub trait StatefulDecode {
type Reader: Read;
Show 14 methods
// Required methods
fn decode_header(&mut self) -> Result<DataElementHeader>;
fn decode_item_header(&mut self) -> Result<SequenceItemHeader>;
fn read_value(
&mut self,
header: &DataElementHeader,
) -> Result<PrimitiveValue>;
fn read_value_preserved(
&mut self,
header: &DataElementHeader,
) -> Result<PrimitiveValue>;
fn read_value_bytes(
&mut self,
header: &DataElementHeader,
) -> Result<PrimitiveValue>;
fn read_to_vec(&mut self, length: u32, vec: &mut Vec<u8>) -> Result<()>;
fn read_u32_to_vec(&mut self, length: u32, vec: &mut Vec<u32>) -> Result<()>;
fn read_to<W>(&mut self, length: u32, out: W) -> Result<()>
where Self: Sized,
W: Write;
fn skip_bytes(&mut self, length: u32) -> Result<()>;
fn seek(&mut self, position: u64) -> Result<()>
where Self::Reader: Seek;
fn skip_bytes_seek(&mut self, length: u64) -> Result<()>
where Self::Reader: Seek;
fn position(&self) -> u64;
// Provided methods
fn enter_implicit_vr(&mut self) { ... }
fn leave_implicit_vr(&mut self) { ... }
}Required Associated Types§
Required Methods§
Sourcefn decode_header(&mut self) -> Result<DataElementHeader>
fn decode_header(&mut self) -> Result<DataElementHeader>
Same as Decode::decode_header over the bound source.
Sourcefn decode_item_header(&mut self) -> Result<SequenceItemHeader>
fn decode_item_header(&mut self) -> Result<SequenceItemHeader>
Same as Decode::decode_item_header over the bound source.
Sourcefn read_value(&mut self, header: &DataElementHeader) -> Result<PrimitiveValue>
fn read_value(&mut self, header: &DataElementHeader) -> Result<PrimitiveValue>
Eagerly read the following data in the source as a primitive data
value. When reading values in text form, a conversion to a more
maleable type is attempted. Namely, numbers in text form (IS, DS) are
converted to the corresponding binary number types, and date/time
instances are decoded into binary date/time objects of types defined in
the chrono crate. To avoid this conversion, see
read_value_preserved.
§Errors
Returns an error on I/O problems, or if the header VR describes a sequence, which in that case this method should not be used.
Sourcefn read_value_preserved(
&mut self,
header: &DataElementHeader,
) -> Result<PrimitiveValue>
fn read_value_preserved( &mut self, header: &DataElementHeader, ) -> Result<PrimitiveValue>
Eagerly read the following data in the source as a primitive data
value. Unlike read_value, this method will preserve the DICOM value’s
original format: numbers saved as text, as well as dates and times, are
read as strings.
§Errors
Returns an error on I/O problems, or if the header VR describes a sequence, which in that case this method should not be used.
Sourcefn read_value_bytes(
&mut self,
header: &DataElementHeader,
) -> Result<PrimitiveValue>
fn read_value_bytes( &mut self, header: &DataElementHeader, ) -> Result<PrimitiveValue>
Eagerly read the following data in the source as a primitive data value as bytes, regardless of its value representation.
§Errors
Returns an error on I/O problems, or if the header VR describes a sequence, which in that case this method should not be used.
Sourcefn read_to_vec(&mut self, length: u32, vec: &mut Vec<u8>) -> Result<()>
fn read_to_vec(&mut self, length: u32, vec: &mut Vec<u8>) -> Result<()>
Read the following number of bytes into a vector.
Sourcefn read_u32_to_vec(&mut self, length: u32, vec: &mut Vec<u32>) -> Result<()>
fn read_u32_to_vec(&mut self, length: u32, vec: &mut Vec<u32>) -> Result<()>
Read the following number of bytes as a sequence of unsigned 32 bit integers into a vector.
Sourcefn read_to<W>(&mut self, length: u32, out: W) -> Result<()>
fn read_to<W>(&mut self, length: u32, out: W) -> Result<()>
Read the following number of bytes into a generic writer.
Sourcefn skip_bytes(&mut self, length: u32) -> Result<()>
fn skip_bytes(&mut self, length: u32) -> Result<()>
Skip the following bytes into a vector, counting them as if they were read.
Sourcefn seek(&mut self, position: u64) -> Result<()>
fn seek(&mut self, position: u64) -> Result<()>
Reposition the reader so that it starts reading at the reader’s given position.
The number of bytes read is not expected to be modified.
Sourcefn skip_bytes_seek(&mut self, length: u64) -> Result<()>
fn skip_bytes_seek(&mut self, length: u64) -> Result<()>
Skip the following length bytes by seeking past them rather than reading them,
counting them as if they were read (the same position bookkeeping as skip_bytes, which
defined-length sequence/item tracking relies on). Seeking past the end of the source is
not detected here - callers that need that must check the resulting range themselves.
Provided Methods§
Sourcefn enter_implicit_vr(&mut self)
fn enter_implicit_vr(&mut self)
Enter the content of an undefined-length UN element, which PS3.5 6.2.2 requires to be
encoded as a sequence in Implicit VR Little Endian whatever the transfer syntax: element
headers are decoded as Implicit VR Little Endian until the matching
leave_implicit_vr. Calls nest.
Sourcefn leave_implicit_vr(&mut self)
fn leave_implicit_vr(&mut self)
Leave the innermost undefined-length UN content entered with
enter_implicit_vr.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".