From 803c5dfc34ce97e839e7161c5c1cdc1c245b8a81 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Tue, 25 Feb 2025 16:57:21 +1000 Subject: [PATCH] add convenience conversions --- soroban-sdk/src/token/muxed_ext.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/soroban-sdk/src/token/muxed_ext.rs b/soroban-sdk/src/token/muxed_ext.rs index bf31247c6..305ccbc30 100644 --- a/soroban-sdk/src/token/muxed_ext.rs +++ b/soroban-sdk/src/token/muxed_ext.rs @@ -63,6 +63,30 @@ pub enum Mux { Hash(BytesN<32>), } +impl From<()> for Mux { + fn from(_: ()) -> Self { + Self::None + } +} + +impl From for Mux { + fn from(v: u64) -> Self { + Self::Id(v) + } +} + +impl From for Mux { + fn from(v: String) -> Self { + Self::Text(v) + } +} + +impl From> for Mux { + fn from(v: BytesN<32>) -> Self { + Self::Hash(v) + } +} + impl TryFromVal for Mux { type Error = ConversionError;