Skip to content

Commit

Permalink
Simplify signature
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiimk committed Jul 29, 2024
1 parent 9f31147 commit 17adbf8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions dill/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,13 @@ impl Catalog {
}
}

pub fn builders_for_with_meta<'a, Iface, Meta, P>(
pub fn builders_for_with_meta<'a, Iface, Meta>(
&'a self,
pred: P,
pred: impl Fn(&Meta) -> bool + 'a,
) -> Box<dyn Iterator<Item = TypecastBuilder<'a, Iface>> + 'a>
where
Iface: 'static + ?Sized,
Meta: 'static,
P: Fn(&Meta) -> bool,
P: 'a,
{
let iface_type = IfaceTypeId(TypeId::of::<Iface>());
let bindings = self.0.bindings.get_vec(&iface_type);
Expand Down
4 changes: 2 additions & 2 deletions dill/tests/tests/test_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ fn test_metadata() {

// Check helper methods
let mut res = cat
.builders_for_with_meta::<dyn EventHandler, _, _>(|desc: &EventHandlerDesc| {
.builders_for_with_meta::<dyn EventHandler, _>(|desc: &EventHandlerDesc| {
desc.event_type == "B"
})
.map(|b| b.instance_type_name())
Expand All @@ -116,7 +116,7 @@ fn test_metadata() {
type ReturnType = Vec<std::sync::Arc<dyn EventHandler>>;

fn get(cat: &dill::Catalog) -> Result<Self::ReturnType, dill::InjectionError> {
cat.builders_for_with_meta::<dyn EventHandler, _, _>(|desc: &EventHandlerDesc| {
cat.builders_for_with_meta::<dyn EventHandler, _>(|desc: &EventHandlerDesc| {
desc.event_type == "A"
})
.map(|b| b.get(cat))
Expand Down

0 comments on commit 17adbf8

Please sign in to comment.