File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 3
3
//! element header, and element composite types.
4
4
5
5
use crate :: error:: { Error , Result } ;
6
- use crate :: value:: { DicomValueType , PrimitiveValue , Value } ;
6
+ use crate :: value:: { PrimitiveValue , Value } ;
7
7
use std:: borrow:: Cow ;
8
8
use std:: cmp:: Ordering ;
9
9
use std:: fmt;
@@ -46,9 +46,23 @@ pub trait Header: HasLength {
46
46
}
47
47
}
48
48
49
+ /// Stub type representing a non-existing DICOM object.
50
+ ///
51
+ /// This type implements `HasLength`, but cannot be instantiated.
52
+ /// This makes it so that `Value<EmptyObject>` is sure to be either a primitive
53
+ /// value or a sequence with no items.
54
+ #[ derive( Debug , PartialEq ) ]
55
+ pub enum EmptyObject { }
56
+
57
+ impl HasLength for EmptyObject {
58
+ fn length ( & self ) -> Length {
59
+ unreachable ! ( )
60
+ }
61
+ }
62
+
49
63
/// A data type that represents and owns a DICOM data element. Unlike
50
64
/// [`PrimitiveDataElement`], this type may contain multiple data elements
51
- /// through the item sequence VR (of type `I`).
65
+ /// through the item sequence VR (where each item contains an object of type `I`).
52
66
#[ derive( Debug , PartialEq , Clone ) ]
53
67
pub struct DataElement < I > {
54
68
header : DataElementHeader ,
Original file line number Diff line number Diff line change @@ -110,6 +110,14 @@ pub trait IntoTokens {
110
110
fn into_tokens ( self ) -> Self :: Iter ;
111
111
}
112
112
113
+ impl IntoTokens for dicom_core:: header:: EmptyObject {
114
+ type Iter = std:: iter:: Empty < DataToken > ;
115
+
116
+ fn into_tokens ( self ) -> Self :: Iter {
117
+ unreachable ! ( )
118
+ }
119
+ }
120
+
113
121
/// Token generator from a DICOM data element.
114
122
pub enum DataElementTokens < I >
115
123
where
You can’t perform that action at this time.
0 commit comments