Struct jbcrs::MethodDescriptor
[−]
[src]
pub struct MethodDescriptor { pub params: Vec<TypeDescriptor>, pub return_type: Option<TypeDescriptor>, }
Fields
params: Vec<TypeDescriptor>
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);
return_type: Option<TypeDescriptor>
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]
pub fn new(
params: Vec<TypeDescriptor>,
return_type: Option<TypeDescriptor>
) -> MethodDescriptor
[src]
params: Vec<TypeDescriptor>,
return_type: Option<TypeDescriptor>
) -> MethodDescriptor
Trait Implementations
impl Eq for MethodDescriptor
[src]
impl PartialEq for MethodDescriptor
[src]
fn eq(&self, __arg_0: &MethodDescriptor) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &MethodDescriptor) -> bool
[src]
This method tests for !=
.
impl Debug for MethodDescriptor
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl FromStr for MethodDescriptor
[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(desc: &str) -> Result<MethodDescriptor>
[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]
fn fmt(&self, f: &mut Formatter) -> Result
[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());