pub struct ScriptList<'a> { /* private fields */ }Expand description
Parsed ScriptList table (chapter 2 §“ScriptList table”).
Layout:
0 / 2 / scriptCount
2 / 6 / scriptRecords[scriptCount] // (tag[4] + scriptOffset[2])The records are sorted alphabetically by tag, so Self::find
runs a binary search.
Implementations§
Source§impl<'a> ScriptList<'a>
impl<'a> ScriptList<'a>
Sourcepub fn parse(bytes: &'a [u8]) -> Result<Self, Error>
pub fn parse(bytes: &'a [u8]) -> Result<Self, Error>
Validate the header and the trailing scriptRecords[] array.
Sourcepub fn tag(&self, i: u16) -> Option<[u8; 4]>
pub fn tag(&self, i: u16) -> Option<[u8; 4]>
Raw 4-byte tag at record index i, or None if out of range.
Sourcepub fn script(&self, i: u16) -> Option<Result<Script<'a>, Error>>
pub fn script(&self, i: u16) -> Option<Result<Script<'a>, Error>>
Parse the Script table referenced by record i. Returns
None for an out-of-range index, an Err if the offset
resolves outside the ScriptList or the Script header itself is
truncated.
Sourcepub fn find(&self, tag: &[u8; 4]) -> Option<Result<Script<'a>, Error>>
pub fn find(&self, tag: &[u8; 4]) -> Option<Result<Script<'a>, Error>>
Look up a Script by tag. Returns None when the tag is absent.
Sourcepub fn iter(&self) -> ScriptListIter<'a> ⓘ
pub fn iter(&self) -> ScriptListIter<'a> ⓘ
Iterate over (tag, script_result) pairs in on-disk order.
Trait Implementations§
Source§impl<'a> Clone for ScriptList<'a>
impl<'a> Clone for ScriptList<'a>
Source§fn clone(&self) -> ScriptList<'a>
fn clone(&self) -> ScriptList<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a> Copy for ScriptList<'a>
Auto Trait Implementations§
impl<'a> Freeze for ScriptList<'a>
impl<'a> RefUnwindSafe for ScriptList<'a>
impl<'a> Send for ScriptList<'a>
impl<'a> Sync for ScriptList<'a>
impl<'a> Unpin for ScriptList<'a>
impl<'a> UnsafeUnpin for ScriptList<'a>
impl<'a> UnwindSafe for ScriptList<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more