Skip to main content

JvmMethodBuilder

Struct JvmMethodBuilder 

Source
pub struct JvmMethodBuilder { /* private fields */ }
Expand description

JVM method builder

Implementations§

Source§

impl JvmMethodBuilder

Source

pub fn new(name: String, descriptor: String) -> Self

Creates a new JVM method builder with the given name and descriptor

Source

pub fn with_public(self) -> Self

Sets the method as public

Source

pub fn with_private(self) -> Self

Sets the method as private

Source

pub fn with_protected(self) -> Self

Sets the method as protected

Source

pub fn with_static(self) -> Self

Sets the method as static

Source

pub fn with_final(self) -> Self

Sets the method as final

Source

pub fn with_synchronized(self) -> Self

Sets the method as synchronized

Source

pub fn with_max_stack(self, max_stack: u16) -> Self

Sets the maximum stack size for the method

Source

pub fn with_max_locals(self, max_locals: u16) -> Self

Sets the maximum number of local variables for the method

Source

pub fn add_instruction(self, instruction: JvmInstruction) -> Self

Adds an instruction to the method

Source

pub fn add_exception_handler(self, handler: JvmExceptionHandler) -> Self

Adds an exception handler to the method

Source

pub fn add_exception(self, exception: impl Into<String>) -> Self

Adds a thrown exception to the method

Source

pub fn nop(self) -> Self

Adds a NOP instruction

Source

pub fn aconst_null(self) -> Self

Adds an ACONST_NULL instruction

Source

pub fn iconst_m1(self) -> Self

Adds an ICONST_M1 instruction

Source

pub fn iconst_0(self) -> Self

Adds an ICONST_0 instruction

Source

pub fn iconst_1(self) -> Self

Adds an ICONST_1 instruction

Source

pub fn iconst_2(self) -> Self

Adds an ICONST_2 instruction

Source

pub fn iconst_3(self) -> Self

Adds an ICONST_3 instruction

Source

pub fn iconst_4(self) -> Self

Adds an ICONST_4 instruction

Source

pub fn iconst_5(self) -> Self

Adds an ICONST_5 instruction

Source

pub fn lconst_0(self) -> Self

Adds an LCONST_0 instruction

Source

pub fn lconst_1(self) -> Self

Adds an LCONST_1 instruction

Source

pub fn fconst_0(self) -> Self

Adds an FCONST_0 instruction

Source

pub fn fconst_1(self) -> Self

Adds an FCONST_1 instruction

Source

pub fn fconst_2(self) -> Self

Adds an FCONST_2 instruction

Source

pub fn dconst_0(self) -> Self

Adds a DCONST_0 instruction

Source

pub fn dconst_1(self) -> Self

Adds a DCONST_1 instruction

Source

pub fn bipush(self, value: i8) -> Self

Adds a BIPUSH instruction

Source

pub fn sipush(self, value: i16) -> Self

Adds a SIPUSH instruction

Source

pub fn ldc(self, symbol: impl Into<String>) -> Self

Adds an LDC instruction

Source

pub fn iload(self, index: u16) -> Self

Adds an ILOAD instruction

Source

pub fn lload(self, index: u16) -> Self

Adds an LLOAD instruction

Source

pub fn fload(self, index: u16) -> Self

Adds an FLOAD instruction

Source

pub fn dload(self, index: u16) -> Self

Adds a DLOAD instruction

Source

pub fn aload(self, index: u16) -> Self

Adds an ALOAD instruction

Source

pub fn iload_0(self) -> Self

Adds an ILOAD_0 instruction

Source

pub fn iload_1(self) -> Self

Adds an ILOAD_1 instruction

Source

pub fn iload_2(self) -> Self

Adds an ILOAD_2 instruction

Source

pub fn iload_3(self) -> Self

Adds an ILOAD_3 instruction

Source

pub fn lload_0(self) -> Self

Adds an LLOAD_0 instruction

Source

pub fn lload_1(self) -> Self

Adds an LLOAD_1 instruction

Source

pub fn lload_2(self) -> Self

Adds an LLOAD_2 instruction

Source

pub fn lload_3(self) -> Self

Adds an LLOAD_3 instruction

Source

pub fn fload_0(self) -> Self

Adds an FLOAD_0 instruction

Source

pub fn fload_1(self) -> Self

Adds an FLOAD_1 instruction

Source

pub fn fload_2(self) -> Self

Adds an FLOAD_2 instruction

Source

pub fn fload_3(self) -> Self

Adds an FLOAD_3 instruction

Source

pub fn dload_0(self) -> Self

Adds a DLOAD_0 instruction

Source

pub fn dload_1(self) -> Self

Adds a DLOAD_1 instruction

Source

pub fn dload_2(self) -> Self

Adds a DLOAD_2 instruction

Source

pub fn dload_3(self) -> Self

Adds a DLOAD_3 instruction

Source

pub fn aload_0(self) -> Self

Adds an ALOAD_0 instruction

Source

pub fn aload_1(self) -> Self

Adds an ALOAD_1 instruction

Source

pub fn aload_2(self) -> Self

Adds an ALOAD_2 instruction

Source

pub fn aload_3(self) -> Self

Adds an ALOAD_3 instruction

Source

pub fn istore(self, index: u16) -> Self

Adds an ISTORE instruction

Source

pub fn lstore(self, index: u16) -> Self

Adds an LSTORE instruction

Source

pub fn fstore(self, index: u16) -> Self

Adds an FSTORE instruction

Source

pub fn dstore(self, index: u16) -> Self

Adds a DSTORE instruction

Source

pub fn astore(self, index: u16) -> Self

Adds an ASTORE instruction

Source

pub fn istore_0(self) -> Self

Adds an ISTORE_0 instruction

Source

pub fn istore_1(self) -> Self

Adds an ISTORE_1 instruction

Source

pub fn istore_2(self) -> Self

Adds an ISTORE_2 instruction

Source

pub fn istore_3(self) -> Self

Adds an ISTORE_3 instruction

Source

pub fn lstore_0(self) -> Self

Adds an LSTORE_0 instruction

Source

pub fn lstore_1(self) -> Self

Adds an LSTORE_1 instruction

Source

pub fn lstore_2(self) -> Self

Adds an LSTORE_2 instruction

Source

pub fn lstore_3(self) -> Self

Adds an LSTORE_3 instruction

Source

pub fn fstore_0(self) -> Self

Adds an FSTORE_0 instruction

Source

pub fn fstore_1(self) -> Self

Adds an FSTORE_1 instruction

Source

pub fn fstore_2(self) -> Self

Adds an FSTORE_2 instruction

Source

pub fn fstore_3(self) -> Self

Adds an FSTORE_3 instruction

Source

pub fn dstore_0(self) -> Self

Adds a DSTORE_0 instruction

Source

pub fn dstore_1(self) -> Self

Adds a DSTORE_1 instruction

Source

pub fn dstore_2(self) -> Self

Adds a DSTORE_2 instruction

Source

pub fn dstore_3(self) -> Self

Adds a DSTORE_3 instruction

Source

pub fn astore_0(self) -> Self

Adds an ASTORE_0 instruction

Source

pub fn astore_1(self) -> Self

Adds an ASTORE_1 instruction

Source

pub fn astore_2(self) -> Self

Adds an ASTORE_2 instruction

Source

pub fn astore_3(self) -> Self

Adds an ASTORE_3 instruction

Source

pub fn iadd(self) -> Self

Adds an IADD instruction

Source

pub fn ladd(self) -> Self

Adds an LADD instruction

Source

pub fn fadd(self) -> Self

Adds an FADD instruction

Source

pub fn dadd(self) -> Self

Adds a DADD instruction

Source

pub fn isub(self) -> Self

Adds an ISUB instruction

Source

pub fn lsub(self) -> Self

Adds an LSUB instruction

Source

pub fn fsub(self) -> Self

Adds an FSUB instruction

Source

pub fn dsub(self) -> Self

Adds a DSUB instruction

Source

pub fn imul(self) -> Self

Adds an IMUL instruction

Source

pub fn lmul(self) -> Self

Adds an LMUL instruction

Source

pub fn fmul(self) -> Self

Adds an FMUL instruction

Source

pub fn dmul(self) -> Self

Adds a DMUL instruction

Source

pub fn idiv(self) -> Self

Adds an IDIV instruction

Source

pub fn ldiv(self) -> Self

Adds an LDIV instruction

Source

pub fn fdiv(self) -> Self

Adds an FDIV instruction

Source

pub fn ddiv(self) -> Self

Adds a DDIV instruction

Source

pub fn irem(self) -> Self

Adds an IREM instruction

Source

pub fn lrem(self) -> Self

Adds an LREM instruction

Source

pub fn frem(self) -> Self

Adds an FREM instruction

Source

pub fn drem(self) -> Self

Adds a DREM instruction

Source

pub fn ineg(self) -> Self

Adds an INEG instruction

Source

pub fn lneg(self) -> Self

Adds an LNEG instruction

Source

pub fn fneg(self) -> Self

Adds an FNEG instruction

Source

pub fn dneg(self) -> Self

Adds a DNEG instruction

Source

pub fn ishl(self) -> Self

Adds an ISHL instruction

Source

pub fn lshl(self) -> Self

Adds an LSHL instruction

Source

pub fn ishr(self) -> Self

Adds an ISHR instruction

Source

pub fn lshr(self) -> Self

Adds an LSHR instruction

Source

pub fn iushr(self) -> Self

Adds an IUSHR instruction

Source

pub fn lushr(self) -> Self

Adds an LUSHR instruction

Source

pub fn iand(self) -> Self

Adds an IAND instruction

Source

pub fn land(self) -> Self

Adds a LAND instruction

Source

pub fn ior(self) -> Self

Adds an IOR instruction

Source

pub fn lor(self) -> Self

Adds a LOR instruction

Source

pub fn ixor(self) -> Self

Adds an IXOR instruction

Source

pub fn lxor(self) -> Self

Adds an LXOR instruction

Source

pub fn lcmp(self) -> Self

Adds an LCMP instruction

Source

pub fn fcmpl(self) -> Self

Adds an FCMPL instruction

Source

pub fn fcmpg(self) -> Self

Adds an FCMPG instruction

Source

pub fn dcmpl(self) -> Self

Adds a DCMPL instruction

Source

pub fn dcmpg(self) -> Self

Adds a DCMPG instruction

Source

pub fn iinc(self, index: u16, value: i16) -> Self

Adds an IINC instruction

Source

pub fn getstatic( self, class: impl Into<String>, name: impl Into<String>, desc: impl Into<String>, ) -> Self

Adds a GETSTATIC instruction

Source

pub fn putstatic( self, class: impl Into<String>, name: impl Into<String>, desc: impl Into<String>, ) -> Self

Adds a PUTSTATIC instruction

Source

pub fn getfield( self, class: impl Into<String>, name: impl Into<String>, desc: impl Into<String>, ) -> Self

Adds a GETFIELD instruction

Source

pub fn putfield( self, class: impl Into<String>, name: impl Into<String>, desc: impl Into<String>, ) -> Self

Adds a PUTFIELD instruction

Source

pub fn invokevirtual( self, class: impl Into<String>, name: impl Into<String>, desc: impl Into<String>, ) -> Self

Adds an INVOKEVIRTUAL instruction

Source

pub fn invokespecial( self, class: impl Into<String>, name: impl Into<String>, desc: impl Into<String>, ) -> Self

Adds an INVOKESPECIAL instruction

Source

pub fn invokestatic( self, class: impl Into<String>, name: impl Into<String>, desc: impl Into<String>, ) -> Self

Adds an INVOKESTATIC instruction

Source

pub fn invokeinterface( self, class: impl Into<String>, name: impl Into<String>, desc: impl Into<String>, ) -> Self

Adds an INVOKEINTERFACE instruction

Source

pub fn new_instance(self, class: impl Into<String>) -> Self

Adds a NEW instruction

Source

pub fn dup(self) -> Self

Adds a DUP instruction

Source

pub fn dup_x1(self) -> Self

Adds a DUP_X1 instruction

Source

pub fn dup_x2(self) -> Self

Adds a DUP_X2 instruction

Source

pub fn dup2(self) -> Self

Adds a DUP2 instruction

Source

pub fn dup2_x1(self) -> Self

Adds a DUP2_X1 instruction

Source

pub fn dup2_x2(self) -> Self

Adds a DUP2_X2 instruction

Source

pub fn swap(self) -> Self

Adds a SWAP instruction

Source

pub fn pop(self) -> Self

Adds a POP instruction

Source

pub fn pop2(self) -> Self

Adds a POP2 instruction

Source

pub fn return_void(self) -> Self

Adds a RETURN instruction

Source

pub fn ireturn(self) -> Self

Adds an IRETURN instruction

Source

pub fn lreturn(self) -> Self

Adds an LRETURN instruction

Source

pub fn freturn(self) -> Self

Adds an FRETURN instruction

Source

pub fn dreturn(self) -> Self

Adds a DRETURN instruction

Source

pub fn areturn(self) -> Self

Adds an ARETURN instruction

Source

pub fn label(self, name: impl Into<String>) -> Self

Adds a label instruction

Source

pub fn goto(self, target: impl Into<String>) -> Self

Adds a GOTO instruction

Source

pub fn ifeq(self, target: impl Into<String>) -> Self

Adds an IFEQ instruction

Source

pub fn ifne(self, target: impl Into<String>) -> Self

Adds an IFNE instruction

Source

pub fn build(self) -> JvmMethod

Builds and returns the JVM method

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more