Struct jbcrs::MethodDescriptor [] [src]

pub struct MethodDescriptor {
    pub params: Vec<TypeDescriptor>,
    pub return_type: Option<TypeDescriptor>,
}

Fields

The parameter types of the method.

Examples

use jbcrs::{Type, MethodDescriptor};

let desc: MethodDescriptor = "(Z)V".parse().unwrap();
assert_eq!(Type::Boolean, desc.params[0].base_type);

The return type of the method. None indicates 'void'

Examples

use jbcrs::{Type, MethodDescriptor};

let desc: MethodDescriptor = "()I".parse().unwrap();
assert_eq!(Type::Int, desc.return_type.unwrap().base_type);

Methods

impl MethodDescriptor
[src]

[src]

Trait Implementations

impl Eq for MethodDescriptor
[src]

impl PartialEq for MethodDescriptor
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Debug for MethodDescriptor
[src]

[src]

Formats the value using the given formatter.

impl FromStr for MethodDescriptor
[src]

The associated error which can be returned from parsing.

[src]

Parses a string and returns a MethodDescriptor if it succeeded.

Examples

use jbcrs::{Type, TypeDescriptor, MethodDescriptor};

let desc: MethodDescriptor = "([[DLjava/lang/Integer;)V".parse().unwrap();
assert_eq!(desc, MethodDescriptor {
    params: vec![
        TypeDescriptor {
            dimensions: 2,
            base_type: Type::Double,
        },
        TypeDescriptor {
            dimensions: 0,
            base_type: Type::Reference("java/lang/Integer".to_owned()),
        },
    ],
    return_type: None,
});

impl Display for MethodDescriptor
[src]

[src]

Formats this descriptor

Examples

use jbcrs::{Type, MethodDescriptor};

let mut desc: MethodDescriptor = "(Ljava/lang/String;)I".parse().unwrap();
desc.return_type.as_mut().unwrap().base_type = Type::Long;
assert_eq!("(Ljava/lang/String;)J", desc.to_string());

desc.params[0].base_type = Type::Reference("java/lang/Double".to_owned());
assert_eq!("(Ljava/lang/Double;)J", desc.to_string());