Function libxivdat::section::read_section [−][src]
pub fn read_section(dat_file: &mut DATFile) -> Result<Section, DATError>
Expand description
Reads the next Section
from a DATFile
.
Errors
Returns DATError::IncorrectType
if the file appears to be of a DATType
that does not contain sections.
Returns DATError::EndOfFile
if there is not a full section remaining in the file.
If an I/O error occurs while reading the file, a DATError::FileIO
error will be returned wrapping the underlying FS error.
If the tag or content is not valid utf8 text, a DATError::BadEncoding
error will be returned.
Examples
use libxivdat::dat_file::DATFile; use libxivdat::section::read_section; let mut dat_file = DATFile::open("./resources/TEST_SECTION.DAT").unwrap(); let section = read_section(&mut dat_file).unwrap(); assert_eq!(section.tag, "T"); assert_eq!(section.content_size, 24); assert_eq!(section.content, "This is a test section.");