pub fn verify_encoded_lazy<V: Verify, T: codec::Encode>(sig: &V, item: &T, signer: &V::Signer) -> bool {
	// The `Lazy<T>` trait expresses something like `X: FnMut<Output = for<'a> &'a T>`.
	// unfortunately this is a lifetime relationship that can't
	// be expressed without generic associated types, better unification of HRTBs in type position,
	// and some kind of integration into the Fn* traits.
	struct LazyEncode<F> {
		inner: F,
		encoded: Option<Vec<u8>>,
	}

	impl<F: Fn() -> Vec<u8>> traits::Lazy<[u8]> for LazyEncode<F> {
		fn get(&mut self) -> &[u8] {
			self.encoded.get_or_insert_with(&self.inner).as_slice()
		}
	}

	sig.verify(
		LazyEncode { inner: || item.encode(), encoded: None },
		signer,
	)
}
/// Verify a signature on an encoded value in a lazy manner. This can be
/// an optimization if the signature scheme has an "unsigned" escape hash.
Verify a signature on an encoded value in a lazy manner. This can be
an optimization if the signature scheme has an "unsigned" escape hash.
Verify a signature on an encoded value in a lazy manner . This can be an optimization if the signature scheme has an " unsigned " escape hash .
pub fn verify_encoded_lazy<V: Verify, T: codec::Encode>(sig: &V, item: &T, signer: &V::Signer) -> bool {
	// The `Lazy<T>` trait expresses something like `X: FnMut<Output = for<'a> &'a T>`.
	// unfortunately this is a lifetime relationship that can't
	// be expressed without generic associated types, better unification of HRTBs in type position,
	// and some kind of integration into the Fn* traits.
	struct LazyEncode<F> {
		inner: F,
		encoded: Option<Vec<u8>>,
	}
	impl<F: Fn() -> Vec<u8>> traits::Lazy<[u8]> for LazyEncode<F> {
		fn get(&mut self) -> &[u8] {
			self.encoded.get_or_insert_with(&self.inner).as_slice()
		}
	}
	sig.verify(
		LazyEncode { inner: || item.encode(), encoded: None },
		signer,
	)
}
pub fn verify_encoded_lazy < V : Verify , T : codec :: Encode > ( sig : & V , item : & T , signer : & V :: Signer ) -> bool { // The `Lazy<T>` trait expresses something like `X: FnMut<Output = for<'a> &'a T>`. // unfortunately this is a lifetime relationship that can't // be expressed without generic associated types, better unification of HRTBs in type position, // and some kind of integration into the Fn* traits. struct LazyEncode < F > { inner : F , encoded : Option < Vec < u8 > > , } impl < F : Fn ( ) -> Vec < u8 > > traits :: Lazy < [ u8 ] > for LazyEncode < F > { fn get ( & mut self ) -> & [ u8 ] { self . encoded . get_or_insert_with ( & self . inner ) . as_slice ( ) } } sig . verify ( LazyEncode { inner : | | item . encode ( ) , encoded : None } , signer , ) }
Verify a signature on an encoded value in a lazy manner.
Verify a signature on an encoded value in a lazy manner .
sig
&V
item
&T
signer
&V::Signer
sig
&V
item
&T
signer
&V::Signer