api: Add VersionHistory::{deprecated_in, removed_in}
This commit is contained in:
parent
866b01d0c2
commit
08dcf1e224
@ -385,6 +385,16 @@ impl VersionHistory {
|
||||
self.stable_paths.first().map(|(v, _)| *v)
|
||||
}
|
||||
|
||||
/// Returns the Matrix version that deprecated this endpoint, if any.
|
||||
pub fn deprecated_in(&self) -> Option<MatrixVersion> {
|
||||
self.deprecated
|
||||
}
|
||||
|
||||
/// Returns the Matrix version that removed this endpoint, if any.
|
||||
pub fn removed_in(&self) -> Option<MatrixVersion> {
|
||||
self.removed
|
||||
}
|
||||
|
||||
/// Picks the last unstable path, if it exists.
|
||||
pub fn unstable(&self) -> Option<&'static str> {
|
||||
self.unstable_paths.last().copied()
|
||||
|
@ -74,6 +74,6 @@ fn main() {
|
||||
);
|
||||
|
||||
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));
|
||||
assert_eq!(METADATA.history.deprecated_in(), Some(MatrixVersion::V1_2));
|
||||
assert_eq!(METADATA.history.removed_in(), Some(MatrixVersion::V1_3));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user