Skip to main content

DataDescriptiveFile

Struct DataDescriptiveFile 

Source
pub struct DataDescriptiveFile { /* private fields */ }

Implementations§

Source§

impl DataDescriptiveFile

Source

pub fn read<P: AsRef<Path>>(path: P) -> Result<DataDescriptiveFile>

Examples found in repository?
examples/print.rs (line 6)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4    let path = std::env::args().nth(1).ok_or("usage: print <path-to-iso8211-file>")?;
5
6    let ddf = DataDescriptiveFile::read(path)?;
7
8    println!("\nData Descriptive Record:");
9    println!("  File Control Field:");
10    println!("    Tag Pairs:");
11    for tp in ddf.data_descriptive_record().file_control_field().tag_pairs() {
12        println!("      {} -> {}", tp.0, tp.1);
13    }
14
15    println!("    Data Descriptive Fields:");
16    for f in ddf.data_descriptive_record().data_descriptive_fields() {
17        println!("      Field Controls:");
18        println!(
19            "        Data Structure: {}",
20            f.field_controls().data_structure()
21        );
22        println!("        Data Type: {}", f.field_controls().data_type());
23        println!(
24            "        Escape Sequence: {}",
25            f.field_controls().escape_sequence()
26        );
27
28        println!("      Field Name: {}", f.field_name());
29
30        println!("      Array Descriptor: {}", f.array_descriptor());
31
32        println!("      Format Controls:");
33        for fc in f.format_controls().formats() {
34            println!("        Format: {}", fc);
35        }
36    }
37
38    for dr in ddf.data_records() {
39        println!("\nData Record:");
40        for df in dr.data_fields() {
41            println!("  Data Field: {} bytes", df.user_data().len());
42        }
43    }
44
45    Ok(())
46}
Source

pub fn read_buf<T: Read + Seek>( buffer: BufReader<T>, ) -> Result<DataDescriptiveFile>

Source

pub fn data_descriptive_record(&self) -> &DataDescriptiveRecord

Examples found in repository?
examples/print.rs (line 11)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4    let path = std::env::args().nth(1).ok_or("usage: print <path-to-iso8211-file>")?;
5
6    let ddf = DataDescriptiveFile::read(path)?;
7
8    println!("\nData Descriptive Record:");
9    println!("  File Control Field:");
10    println!("    Tag Pairs:");
11    for tp in ddf.data_descriptive_record().file_control_field().tag_pairs() {
12        println!("      {} -> {}", tp.0, tp.1);
13    }
14
15    println!("    Data Descriptive Fields:");
16    for f in ddf.data_descriptive_record().data_descriptive_fields() {
17        println!("      Field Controls:");
18        println!(
19            "        Data Structure: {}",
20            f.field_controls().data_structure()
21        );
22        println!("        Data Type: {}", f.field_controls().data_type());
23        println!(
24            "        Escape Sequence: {}",
25            f.field_controls().escape_sequence()
26        );
27
28        println!("      Field Name: {}", f.field_name());
29
30        println!("      Array Descriptor: {}", f.array_descriptor());
31
32        println!("      Format Controls:");
33        for fc in f.format_controls().formats() {
34            println!("        Format: {}", fc);
35        }
36    }
37
38    for dr in ddf.data_records() {
39        println!("\nData Record:");
40        for df in dr.data_fields() {
41            println!("  Data Field: {} bytes", df.user_data().len());
42        }
43    }
44
45    Ok(())
46}
Source

pub fn data_records(&self) -> &[DataRecord]

Examples found in repository?
examples/print.rs (line 38)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4    let path = std::env::args().nth(1).ok_or("usage: print <path-to-iso8211-file>")?;
5
6    let ddf = DataDescriptiveFile::read(path)?;
7
8    println!("\nData Descriptive Record:");
9    println!("  File Control Field:");
10    println!("    Tag Pairs:");
11    for tp in ddf.data_descriptive_record().file_control_field().tag_pairs() {
12        println!("      {} -> {}", tp.0, tp.1);
13    }
14
15    println!("    Data Descriptive Fields:");
16    for f in ddf.data_descriptive_record().data_descriptive_fields() {
17        println!("      Field Controls:");
18        println!(
19            "        Data Structure: {}",
20            f.field_controls().data_structure()
21        );
22        println!("        Data Type: {}", f.field_controls().data_type());
23        println!(
24            "        Escape Sequence: {}",
25            f.field_controls().escape_sequence()
26        );
27
28        println!("      Field Name: {}", f.field_name());
29
30        println!("      Array Descriptor: {}", f.array_descriptor());
31
32        println!("      Format Controls:");
33        for fc in f.format_controls().formats() {
34            println!("        Format: {}", fc);
35        }
36    }
37
38    for dr in ddf.data_records() {
39        println!("\nData Record:");
40        for df in dr.data_fields() {
41            println!("  Data Field: {} bytes", df.user_data().len());
42        }
43    }
44
45    Ok(())
46}

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.