diff --git a/soroban-sdk/src/bytes.rs b/soroban-sdk/src/bytes.rs index af4094a25..2e427f1ed 100644 --- a/soroban-sdk/src/bytes.rs +++ b/soroban-sdk/src/bytes.rs @@ -299,6 +299,14 @@ impl TryFromVal for Val { } } +impl TryFromVal for Val { + type Error = ConversionError; + + fn try_from_val(_env: &Env, v: &&Bytes) -> Result { + Ok(v.to_val()) + } +} + impl From for Val { #[inline(always)] fn from(v: Bytes) -> Self { @@ -1013,6 +1021,14 @@ impl TryFromVal> for Val { } } +impl TryFromVal> for Val { + type Error = ConversionError; + + fn try_from_val(_env: &Env, v: &&BytesN) -> Result { + Ok(v.to_val()) + } +} + impl TryFrom for BytesN { type Error = ConversionError;