MapFeedback: Adding support for with_name() (#752)

* Adding support for with_name()

* Adding with_name() function description
This commit is contained in:
Patrick Gersch 2022-08-29 14:43:00 +02:00 committed by GitHub
parent 6c50f55cd2
commit ebae4d3ce8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -633,6 +633,21 @@ where
} }
} }
/// Creating a new `MapFeedback` with a specific name. This is usefully whenever the same
/// feedback is needed twice, but with a different history. Using `new()` always results in the
/// same name and therefore also the same history.
#[must_use]
pub fn with_name(name: &'static str, map_observer: &O) -> Self {
Self {
indexes: None,
novelties: None,
name: name.to_string(),
observer_name: map_observer.name().to_string(),
stats_name: create_stats_name(name),
phantom: PhantomData,
}
}
/// Create new `MapFeedback` specifying if it must track indexes of used entries and/or novelties /// Create new `MapFeedback` specifying if it must track indexes of used entries and/or novelties
#[must_use] #[must_use]
pub fn with_names_tracking( pub fn with_names_tracking(