Function libxivdat::section::read_section_unsafe [−][src]
pub fn read_section_unsafe(dat_file: &mut DATFile) -> Result<Section, DATError>
Expand description
Reads the next Section
from a DATFile
. This does not check that the
file is of a type that should contain sections.
Errors
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_unsafe; let mut dat_file = DATFile::open("./resources/TEST_SECTION.DAT").unwrap(); let section = read_section_unsafe(&mut dat_file).unwrap(); assert_eq!(section.tag, "T"); assert_eq!(section.content_size, 24); assert_eq!(section.content, "This is a test section.");