Skip to content

Commit

Permalink
add convenience conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch committed Feb 25, 2025
1 parent 728ebb6 commit 803c5df
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions soroban-sdk/src/token/muxed_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,30 @@ pub enum Mux {
Hash(BytesN<32>),
}

impl From<()> for Mux {
fn from(_: ()) -> Self {
Self::None
}
}

impl From<u64> for Mux {
fn from(v: u64) -> Self {
Self::Id(v)
}
}

impl From<String> for Mux {
fn from(v: String) -> Self {
Self::Text(v)
}
}

impl From<BytesN<32>> for Mux {
fn from(v: BytesN<32>) -> Self {
Self::Hash(v)
}
}

impl TryFromVal<Env, Val> for Mux {
type Error = ConversionError;

Expand Down

0 comments on commit 803c5df

Please sign in to comment.