factorize value parsing
This commit is contained in:
parent
cdf68c506a
commit
77be653786
4 changed files with 123 additions and 67 deletions
|
|
@ -154,6 +154,16 @@ impl<'a> DexFileReader<'a> {
|
|||
)))
|
||||
}
|
||||
|
||||
/// Return a [`ProtoIdItem`] reference from its idx.
|
||||
pub fn get_proto_id(&self, idx: usize) -> Result<&ProtoIdItem> {
|
||||
self.proto_ids
|
||||
.get(idx)
|
||||
.ok_or(Error::InconsistantStruct(format!(
|
||||
"prototype idx {idx} is out of bound (|proto_ids|={})",
|
||||
self.proto_ids.len()
|
||||
)))
|
||||
}
|
||||
|
||||
/// Return a [`FieldIdItem`] reference from its idx.
|
||||
pub fn get_field_id(&self, idx: usize) -> Result<&FieldIdItem> {
|
||||
self.field_ids
|
||||
|
|
@ -164,13 +174,13 @@ impl<'a> DexFileReader<'a> {
|
|||
)))
|
||||
}
|
||||
|
||||
/// Return a [`ProtoIdItem`] reference from its idx.
|
||||
pub fn get_proto_id(&self, idx: usize) -> Result<&ProtoIdItem> {
|
||||
self.proto_ids
|
||||
/// Return a [`MethodIdItem`] reference from its idx.
|
||||
pub fn get_method_id(&self, idx: usize) -> Result<&MethodIdItem> {
|
||||
self.method_ids
|
||||
.get(idx)
|
||||
.ok_or(Error::InconsistantStruct(format!(
|
||||
"prototype idx {idx} is out of bound (|proto_ids|={})",
|
||||
self.proto_ids.len()
|
||||
"method idx {idx} is out of bound (|method_ids|={})",
|
||||
self.method_ids.len()
|
||||
)))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue