pub struct Method { /* private fields */ }
Implementations§
Source§impl Method
impl Method
Sourcepub fn new<S: AsRef<str>>(
access_flags: MethodAccessFlags,
name: S,
descriptor: S,
max_stack: usize,
max_locals: usize,
code: Vec<Instruction>,
line_numbers: Vec<LineNumber>,
exception_table: Vec<ExceptionTableEntry>,
) -> Result<Self>
pub fn new<S: AsRef<str>>( access_flags: MethodAccessFlags, name: S, descriptor: S, max_stack: usize, max_locals: usize, code: Vec<Instruction>, line_numbers: Vec<LineNumber>, exception_table: Vec<ExceptionTableEntry>, ) -> Result<Self>
Sourcepub fn access_flags(&self) -> &MethodAccessFlags
pub fn access_flags(&self) -> &MethodAccessFlags
Get the method access flags.
Sourcepub fn descriptor(&self) -> &str
pub fn descriptor(&self) -> &str
Get the method descriptor.
Sourcepub fn parameters(&self) -> &Vec<FieldType>
pub fn parameters(&self) -> &Vec<FieldType>
Get the method parameters.
Sourcepub fn return_type(&self) -> Option<&FieldType>
pub fn return_type(&self) -> Option<&FieldType>
Get the method return type.
Sourcepub fn identifier(&self) -> String
pub fn identifier(&self) -> String
Get the method identifier.
Sourcepub fn max_locals(&self) -> usize
pub fn max_locals(&self) -> usize
Get the maximum number of local variables.
Sourcepub fn code(&self) -> &Vec<Instruction>
pub fn code(&self) -> &Vec<Instruction>
Get the code.
Sourcepub fn line_number(&self, program_counter: usize) -> usize
pub fn line_number(&self, program_counter: usize) -> usize
Get the line number for a given program counter.
§Errors
if the program counter does not index into a valid line number
Sourcepub fn exception_table(&self) -> &Vec<ExceptionTableEntry>
pub fn exception_table(&self) -> &Vec<ExceptionTableEntry>
Get the exception table.
Sourcepub fn parse_descriptor(
descriptor: &str,
) -> Result<(Vec<FieldType>, Option<FieldType>)>
pub fn parse_descriptor( descriptor: &str, ) -> Result<(Vec<FieldType>, Option<FieldType>)>
Parse the method descriptor. The descriptor is a string representing the method signature. The descriptor has the following format:
See: https://docs.oracle.com/javase/specs/jvms/se23/html/jvms-4.html#jvms-4.3.3
§Errors
if the descriptor cannot be parsed
Trait Implementations§
impl StructuralPartialEq for Method
Auto Trait Implementations§
impl Freeze for Method
impl RefUnwindSafe for Method
impl Send for Method
impl Sync for Method
impl Unpin for Method
impl UnwindSafe for Method
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