feat: harmony-cli v0.1 #8 #9
@@ -53,10 +53,9 @@ pub async fn init<T: Topology + std::fmt::Debug + Send + Sync + 'static>(
|
||||
|
||||
|
|
||||
let scores = maestro.scores();
|
||||
let scores_read = scores.read().expect("Should be able to read scores");
|
||||
let scores_read_vec: Vec<Box<dyn Score<T>>> =
|
||||
scores_read.iter().map(|s| s.clone_box()).collect();
|
||||
let filtered: Vec<&Box<dyn Score<T>>> = scores_read_vec
|
||||
let filtered: Vec<Box<dyn Score<T>>> = scores_read
|
||||
.iter()
|
||||
.map(|s| s.clone_box())
|
||||
.filter(|s| s.name().contains(&args.run))
|
||||
.collect();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user
So much better. I think there are more Rust idiomatic ways to handle that with Slices or something but it's good enough :
Now though you should at least reverse the map and filter calls so scores don't all get cloned for nothing.
In general you always filter your ensemble before processing.