pub struct Reader<'a> {
pub wide_seen: bool,
/* private fields */
}Expand description
A reader of a resource’s fields, little-endian, that knows the block structure.
Fields§
§wide_seen: boolA UTF-16 System::String was read (older builds write every string that way).
Implementations§
Source§impl<'a> Reader<'a>
impl<'a> Reader<'a>
Sourcepub fn set_reference_ids(&mut self, ids: Arc<BTreeMap<u32, String>>)
pub fn set_reference_ids(&mut self, ids: Arc<BTreeMap<u32, String>>)
Read external pointers as reference ids (ExternalFactory reference mode, used by saves).
Sourcepub fn remaining(&self) -> usize
pub fn remaining(&self) -> usize
The number of bytes left before the end of the readable range.
Sourcepub fn slice(&self, start: usize, end: usize) -> Result<&'a [u8]>
pub fn slice(&self, start: usize, end: usize) -> Result<&'a [u8]>
Bytes already read or ahead, by absolute position.
Sourcepub fn limit(&mut self, end: usize) -> Result<usize>
pub fn limit(&mut self, end: usize) -> Result<usize>
Narrow the readable range to end at end (inside the current one); returns the old
end for Reader::unlimit.
Sourcepub fn wstring(&mut self) -> Result<String>
pub fn wstring(&mut self) -> Result<String>
A u32 count of UTF-16 units, the terminating NUL included (0 for an empty string), then
the units.
Original: System::String::Serialize, Runtime 0x1800cc1a0.
Sourcepub fn string(&mut self) -> Result<String>
pub fn string(&mut self) -> Result<String>
Read a string: a length with bit 31 set for 8-bit text (else UTF-16), then the characters with the terminating zero.
Sourcepub fn external_ref(&mut self) -> Result<Option<String>>
pub fn external_ref(&mut self) -> Result<Option<String>>
ExternalPtr: bool present, then a Path\File.rsc:object reference.
Sourcepub fn block<T>(
&mut self,
f: impl FnOnce(&mut Self, u32) -> Result<T>,
) -> Result<T>
pub fn block<T>( &mut self, f: impl FnOnce(&mut Self, u32) -> Result<T>, ) -> Result<T>
Read one block, running f over its payload. Fails unless f consumes it exactly.
Sourcepub fn skip_block(&mut self) -> Result<()>
pub fn skip_block(&mut self) -> Result<()>
Skip a block without interpreting it.