pub struct NativeMethodHint {
pub contract: &'static str,
pub canonical_method: Option<&'static str>,
}Expand description
Additional metadata explaining how a method token maps to a native contract.
This is returned by describe_method_token to help callers surface a friendly
label for native calls.
The NativeMethodHint::contract field always contains the canonical native
contract name. The NativeMethodHint::canonical_method field is Some when
the provided method name matches one of the known native methods.
Fields§
§contract: &'static strCanonical native contract name.
canonical_method: Option<&'static str>Canonical method name when it could be resolved.
Implementations§
Source§impl NativeMethodHint
impl NativeMethodHint
Sourcepub fn formatted_label(&self, provided: &str) -> String
pub fn formatted_label(&self, provided: &str) -> String
Format a label for displaying this hint.
When NativeMethodHint::canonical_method is known, this returns
<contract>::<method>. Otherwise it embeds the provided method name as
<contract>::<unknown <provided>>.
§Examples
use neo_decompiler::native_contracts::NativeMethodHint;
let hint = NativeMethodHint { contract: "Contract", canonical_method: Some("Method") };
assert_eq!(hint.formatted_label("ignored"), "Contract::Method");
let hint = NativeMethodHint { contract: "Contract", canonical_method: None };
assert_eq!(hint.formatted_label("Provided"), "Contract::<unknown Provided>");Sourcepub fn has_exact_method(&self) -> bool
pub fn has_exact_method(&self) -> bool
Return true if the hint resolved the provided method to a known native method.
Trait Implementations§
Source§impl Clone for NativeMethodHint
impl Clone for NativeMethodHint
Source§impl Debug for NativeMethodHint
impl Debug for NativeMethodHint
impl Eq for NativeMethodHint
Source§impl PartialEq for NativeMethodHint
impl PartialEq for NativeMethodHint
impl StructuralPartialEq for NativeMethodHint
Auto Trait Implementations§
impl Freeze for NativeMethodHint
impl RefUnwindSafe for NativeMethodHint
impl Send for NativeMethodHint
impl Sync for NativeMethodHint
impl Unpin for NativeMethodHint
impl UnsafeUnpin for NativeMethodHint
impl UnwindSafe for NativeMethodHint
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.