Struct noak::descriptor::MethodDescriptor
source · pub struct MethodDescriptor<'a> { /* private fields */ }
Expand description
A method descriptor specifies the parameter types and return type of a method.
Implementations§
source§impl<'a> MethodDescriptor<'a>
impl<'a> MethodDescriptor<'a>
sourcepub fn parse(input: &'a MStr) -> Result<MethodDescriptor<'a>, DecodeError>
pub fn parse(input: &'a MStr) -> Result<MethodDescriptor<'a>, DecodeError>
Parses a method descriptor as described in §4.3.3.
§Examples
use noak::descriptor::{BaseType, MethodDescriptor, TypeDescriptor};
use noak::MStr;
let descriptor = MethodDescriptor::parse(MStr::from_mutf8(b"(Ljava/lang/String;)I").unwrap()).unwrap();
assert_eq!(descriptor.parameters().count(), 1);
assert_eq!(descriptor.return_type(), Some(TypeDescriptor { dimensions: 0, base: BaseType::Integer }));
sourcepub fn parameters(&self) -> impl Iterator<Item = TypeDescriptor<'a>> + 'a
pub fn parameters(&self) -> impl Iterator<Item = TypeDescriptor<'a>> + 'a
Returns an iterator over the method parameters.
sourcepub fn return_type(&self) -> Option<TypeDescriptor<'a>>
pub fn return_type(&self) -> Option<TypeDescriptor<'a>>
Returns the return type of this method descriptor.
If the return type is void (V
), then None
is returned.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for MethodDescriptor<'a>
impl<'a> RefUnwindSafe for MethodDescriptor<'a>
impl<'a> Send for MethodDescriptor<'a>
impl<'a> Sync for MethodDescriptor<'a>
impl<'a> Unpin for MethodDescriptor<'a>
impl<'a> UnwindSafe for MethodDescriptor<'a>
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