pub struct ClassReader { /* private fields */ }Expand description
A parser to make a ClassVisitor visit a ClassFile structure.
This class parses a byte array conforming to the Java class file format and calls the appropriate methods of a given class visitor for each field, method, and bytecode instruction encountered.
Implementations§
Source§impl ClassReader
impl ClassReader
Sourcepub fn new(bytes: &[u8]) -> Self
pub fn new(bytes: &[u8]) -> Self
Constructs a new ClassReader with the given class file bytes.
§Arguments
bytes- A byte slice containing the JVM class file data.
Sourcepub fn accept(
&self,
visitor: &mut dyn ClassVisitor,
_options: u32,
) -> Result<(), ClassReadError>
pub fn accept( &self, visitor: &mut dyn ClassVisitor, _options: u32, ) -> Result<(), ClassReadError>
Makes the given visitor visit the Java class of this ClassReader.
This method parses the class file data and drives the visitor events.
§Arguments
visitor- The visitor that must visit this class._options- Option flags (currently unused, reserve for future parsing options like skipping debug info).
§Errors
Returns a ClassReadError if the class file is malformed or contains unsupported versions.
Sourcepub fn to_class_node(&self) -> Result<ClassNode, ClassReadError>
pub fn to_class_node(&self) -> Result<ClassNode, ClassReadError>
Converts the read class data directly into a ClassNode.
This is a convenience method that parses the bytes and builds a complete object model of the class.
Auto Trait Implementations§
impl Freeze for ClassReader
impl RefUnwindSafe for ClassReader
impl Send for ClassReader
impl Sync for ClassReader
impl Unpin for ClassReader
impl UnsafeUnpin for ClassReader
impl UnwindSafe for ClassReader
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