TBD,
}
-type DictIndex = usize;
-
#[derive(Clone, Debug)]
pub struct Headers {
pub header: HeaderRecord<String>,
#[derive(Debug)]
pub struct Metadata {
- creation: NaiveDateTime,
- endian: Endian,
- compression: Option<Compression>,
- n_cases: Option<u64>,
- product: String,
- product_ext: Option<String>,
- version: Option<(i32, i32, i32)>,
+ pub creation: NaiveDateTime,
+ pub endian: Endian,
+ pub compression: Option<Compression>,
+ pub n_cases: Option<u64>,
+ pub product: String,
+ pub product_ext: Option<String>,
+ pub version: Option<(i32, i32, i32)>,
}
impl Metadata {
// Assign variable roles.
for index in 0..dictionary.variables.len() {
- let mut variable = dictionary.variables.get_index_mut2(index).unwrap();
+ let variable = dictionary.variables.get_index_mut2(index).unwrap();
match variable.attributes.role() {
Ok(role) => variable.role = role,
Err(()) => warn(Error::TBD),
return Err(Error::MixedMrSet(mr_set_name));
};
- let mr_type = MultipleResponseType::decode(&mr_set_name, &input.mr_type, min_width, warn)?;
+ let mr_type = MultipleResponseType::decode(&mr_set_name, &input.mr_type, min_width)?;
Ok(MultipleResponseSet {
name: mr_set_name,
mr_set: &Identifier,
input: &raw::MultipleResponseType,
min_width: VarWidth,
- warn: &impl Fn(Error),
) -> Result<Self, Error> {
match input {
raw::MultipleResponseType::MultipleDichotomy { value, labels } => {
ZLib,
}
-trait Header {
- fn offsets(&self) -> Range<u64>;
-}
-
#[derive(Clone)]
pub struct HeaderRecord<S>
where
}
}
-impl<S> Header for HeaderRecord<S>
-where
- S: Debug,
-{
- fn offsets(&self) -> Range<u64> {
- self.offsets.clone()
- }
-}
-
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub enum Magic {
/// Regular system file.
type RawValue = Value<RawStr<8>>;
impl RawValue {
- fn read<R: Read>(r: &mut R, var_type: VarType, endian: Endian) -> Result<Self, IoError> {
- Ok(Self::from_raw(
- &UntypedValue(read_bytes(r)?),
- var_type,
- endian,
- ))
- }
-
pub fn from_raw(raw: &UntypedValue, var_type: VarType, endian: Endian) -> Self {
match var_type {
VarType::String => Value::String(RawStr(raw.0)),
}
}
-impl<V, S> Header for ValueLabelRecord<V, S>
-where
- V: Debug,
- S: Debug,
-{
- fn offsets(&self) -> Range<u64> {
- self.offsets.clone()
- }
-}
-
impl<V, S> ValueLabelRecord<V, S>
where
V: Debug,
}
}
-impl<S> Header for DocumentRecord<S>
-where
- S: Debug,
-{
- fn offsets(&self) -> Range<u64> {
- self.offsets.clone()
- }
-}
-
trait ExtensionRecord {
const SUBTYPE: u32;
const SIZE: Option<u32>;