substrate_stellar_sdk/xdr/impls/
hash.rs

1use crate::{AsBinary, Hash, StellarSdkError};
2
3pub trait IntoHash {
4    fn into_hash(self) -> Result<Hash, StellarSdkError>;
5}
6
7impl IntoHash for Hash {
8    fn into_hash(self) -> Result<Hash, StellarSdkError> {
9        Ok(self)
10    }
11}
12
13impl<T: AsRef<[u8]>> IntoHash for AsBinary<T> {
14    fn into_hash(self) -> Result<Hash, StellarSdkError> {
15        self.as_binary()
16    }
17}