Skip to content

Commit

Permalink
remove recursive conversion for Metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
rbran committed Apr 16, 2024
1 parent 9fdd5d0 commit 152219c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions rust/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,6 @@ impl From<&str> for Ref<Metadata> {
}
}

impl<T: Into<Ref<Metadata>>> From<&T> for Ref<Metadata> {
fn from(value: &T) -> Self {
value.into()
}
}

impl From<&Vec<u8>> for Ref<Metadata> {
fn from(value: &Vec<u8>) -> Self {
unsafe { Metadata::ref_from_raw(BNCreateMetadataRawData(value.as_ptr(), value.len())) }
Expand Down Expand Up @@ -461,7 +455,11 @@ impl<S: BnStrCompatible> From<HashMap<S, Ref<Metadata>>> for Ref<Metadata> {
}
}

impl<S: BnStrCompatible + Copy, T: Into<Ref<Metadata>>> From<&[(S, T)]> for Ref<Metadata> {
impl<S, T> From<&[(S, T)]> for Ref<Metadata>
where
S: BnStrCompatible + Copy,
for<'a> &'a T: Into<Ref<Metadata>>,
{
fn from(value: &[(S, T)]) -> Self {
let data: Vec<(S::Result, Ref<Metadata>)> = value
.into_iter()
Expand All @@ -483,8 +481,10 @@ impl<S: BnStrCompatible + Copy, T: Into<Ref<Metadata>>> From<&[(S, T)]> for Ref<
}
}

impl<S: BnStrCompatible + Copy, T: Into<Ref<Metadata>>, const N: usize> From<[(S, T); N]>
for Ref<Metadata>
impl<S, T, const N: usize> From<[(S, T); N]> for Ref<Metadata>
where
S: BnStrCompatible + Copy,
for<'a> &'a T: Into<Ref<Metadata>>,
{
fn from(value: [(S, T); N]) -> Self {
let slice = &value[..];
Expand Down

0 comments on commit 152219c

Please sign in to comment.