pub struct MethodResolver<T>where
T: Hasher,{ /* private fields */ }Expand description
Uses an underlying hashing function (blake2b by convention) to generate method numbers from method names.
Implementations§
Source§impl<T> MethodResolver<T>where
T: Hasher,
impl<T> MethodResolver<T>where
T: Hasher,
Sourcepub fn new(hasher: T) -> MethodResolver<T>
pub fn new(hasher: T) -> MethodResolver<T>
Creates a MethodResolver with an instance of a hasher (blake2b by convention).
Sourcepub fn method_number(&self, method_name: &str) -> Result<u64, MethodNameErr>
pub fn method_number(&self, method_name: &str) -> Result<u64, MethodNameErr>
Generates a standard FRC-0042 compliant method number.
The method number is calculated as the first four bytes of hash(method-name).
The name Constructor is always hashed to 1 and other method names that hash to
0 or 1 are avoided via rejection sampling.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for MethodResolver<T>where
T: Freeze,
impl<T> RefUnwindSafe for MethodResolver<T>where
T: RefUnwindSafe,
impl<T> Send for MethodResolver<T>where
T: Send,
impl<T> Sync for MethodResolver<T>where
T: Sync,
impl<T> Unpin for MethodResolver<T>where
T: Unpin,
impl<T> UnwindSafe for MethodResolver<T>where
T: UnwindSafe,
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