api: Rename VersionHistory::added_version to added_in

… and reword its documentation.
This commit is contained in:
Jonas Platte 2022-11-10 10:45:10 +01:00
parent 848ca9b225
commit 866b01d0c2
No known key found for this signature in database
GPG Key ID: AAA7A61F696C3E0C
2 changed files with 6 additions and 6 deletions

View File

@ -364,7 +364,7 @@ impl VersionHistory {
}
// Check if *any* version marks this endpoint as stable.
if self.added_version().map_or(false, greater_or_equal_any) {
if self.added_in().map_or(false, greater_or_equal_any) {
let all_deprecated = self.deprecated.map_or(false, greater_or_equal_all);
return VersioningDecision::Stable {
@ -378,11 +378,11 @@ impl VersionHistory {
VersioningDecision::Unstable
}
/// Will return the *first* version this path was added in.
/// Returns the *first* version this endpoint was added in.
///
/// Is None when this endpoint is unstable/unreleased.
pub fn added_version(&self) -> Option<MatrixVersion> {
self.stable_paths.first().map(|(x, _)| *x)
/// Is `None` when this endpoint is unstable/unreleased.
pub fn added_in(&self) -> Option<MatrixVersion> {
self.stable_paths.first().map(|(v, _)| *v)
}
/// Picks the last unstable path, if it exists.

View File

@ -73,7 +73,7 @@ fn main() {
]
);
assert_eq!(METADATA.history.added_version(), Some(MatrixVersion::V1_0));
assert_eq!(METADATA.history.added_in(), Some(MatrixVersion::V1_0));
assert_eq!(METADATA.history.deprecated, Some(MatrixVersion::V1_2));
assert_eq!(METADATA.history.removed, Some(MatrixVersion::V1_3));
}