Skip to content

Commit

Permalink
feat(ga): implement with_probes for AggregatedProbe (#419)
Browse files Browse the repository at this point in the history
## Description

Such method simplifies creation of `AggregatedProbe`

## Linked issues

Closes #408

## Important implementation details

Currently each element in the passed array must be of the `Box` type.
  • Loading branch information
kkafar authored Aug 22, 2023
1 parent e9ecd0a commit f10bbd5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/ga/probe/aggregated_probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ impl<IndividualT: IndividualTrait> AggregatedProbe<IndividualT> {
Self { probes: Vec::new() }
}

/// Returns new instance of [AggregatedProbe] initialized
/// with given probes.
///
/// ### Arguments
///
/// * `probes` - Iterable with probes
pub fn with_probes<ProbeList>(probes: ProbeList) -> Self
where
ProbeList: IntoIterator<Item = Box<dyn Probe<IndividualT>>>,
{
Self {
probes: Vec::from_iter(probes),
}
}

/// Add probe to list
///
/// **Note**: Probes will be called in order they were added
Expand Down

0 comments on commit f10bbd5

Please sign in to comment.