Skip to content
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.

Commit

Permalink
fill in more otlp configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
KodrAus committed Jan 24, 2024
1 parent c7d6837 commit c859146
Show file tree
Hide file tree
Showing 4 changed files with 251 additions and 157 deletions.
44 changes: 44 additions & 0 deletions core/src/props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,50 @@ where
}
}

#[cfg(feature = "alloc")]
impl<K, V> Props for alloc::collections::BTreeMap<K, V>
where
K: Ord + ToStr + Borrow<str>,
V: ToValue,
{
fn for_each<'kv, F: FnMut(Str<'kv>, Value<'kv>) -> ControlFlow<()>>(
&'kv self,
mut for_each: F,
) -> ControlFlow<()> {
for (k, v) in self {
for_each(k.to_str(), v.to_value())?;
}

ControlFlow::Continue(())
}

fn get<'v, Q: ToStr>(&'v self, key: Q) -> Option<Value<'v>> {
self.get(key.to_str().as_ref()).map(|v| v.to_value())
}
}

#[cfg(feature = "std")]
impl<K, V> Props for std::collections::HashMap<K, V>
where
K: Eq + std::hash::Hash + ToStr + Borrow<str>,
V: ToValue,
{
fn for_each<'kv, F: FnMut(Str<'kv>, Value<'kv>) -> ControlFlow<()>>(
&'kv self,
mut for_each: F,
) -> ControlFlow<()> {
for (k, v) in self {
for_each(k.to_str(), v.to_value())?;
}

ControlFlow::Continue(())
}

fn get<'v, Q: ToStr>(&'v self, key: Q) -> Option<Value<'v>> {
self.get(key.to_str().as_ref()).map(|v| v.to_value())
}
}

impl Props for Empty {
fn for_each<'kv, F: FnMut(Str<'kv>, Value<'kv>) -> ControlFlow<()>>(
&'kv self,
Expand Down
Loading

0 comments on commit c859146

Please sign in to comment.