Struct matrix_sdk_base::ruma::api::VersionHistory
source · pub struct VersionHistory { /* private fields */ }
api
only.Expand description
The complete history of this endpoint as far as Ruma knows, together with all variants on versions stable and unstable.
The amount and positioning of path variables are the same over all path variants.
Implementations§
source§impl VersionHistory
impl VersionHistory
sourcepub const fn new(
unstable_paths: &'static [&'static str],
stable_paths: &'static [(MatrixVersion, &'static str)],
deprecated: Option<MatrixVersion>,
removed: Option<MatrixVersion>,
) -> VersionHistory
pub const fn new( unstable_paths: &'static [&'static str], stable_paths: &'static [(MatrixVersion, &'static str)], deprecated: Option<MatrixVersion>, removed: Option<MatrixVersion>, ) -> VersionHistory
Constructs an instance of VersionHistory
, erroring on compilation if it does not pass
invariants.
Specifically, this checks the following invariants:
- Path Arguments are equal (in order, amount, and argument name) in all path strings
- In stable_paths:
- matrix versions are in ascending order
- no matrix version is referenced twice
- deprecated’s version comes after the latest version mentioned in stable_paths, except for version 1.0, and only if any stable path is defined
- removed comes after deprecated, or after the latest referenced stable_paths, like deprecated
sourcepub fn versioning_decision_for(
&self,
versions: &[MatrixVersion],
) -> VersioningDecision
pub fn versioning_decision_for( &self, versions: &[MatrixVersion], ) -> VersioningDecision
Will decide how a particular set of Matrix versions sees an endpoint.
It will only return Deprecated
or Removed
if all versions denote it.
In other words, if in any version it tells it supports the endpoint in a stable fashion,
this will return Stable
, even if some versions in this set will denote deprecation or
removal.
If resulting VersioningDecision
is Stable
, it will also detail if any version denoted
deprecation or removal.
sourcepub fn added_in(&self) -> Option<MatrixVersion>
pub fn added_in(&self) -> Option<MatrixVersion>
Returns the first version this endpoint was added in.
Is None
when this endpoint is unstable/unreleased.
sourcepub fn deprecated_in(&self) -> Option<MatrixVersion>
pub fn deprecated_in(&self) -> Option<MatrixVersion>
Returns the Matrix version that deprecated this endpoint, if any.
sourcepub fn removed_in(&self) -> Option<MatrixVersion>
pub fn removed_in(&self) -> Option<MatrixVersion>
Returns the Matrix version that removed this endpoint, if any.
sourcepub fn all_paths(&self) -> impl Iterator<Item = &'static str>
pub fn all_paths(&self) -> impl Iterator<Item = &'static str>
Returns all path variants in canon form, for use in server routers.
sourcepub fn unstable_paths(&self) -> impl Iterator<Item = &'static str>
pub fn unstable_paths(&self) -> impl Iterator<Item = &'static str>
Returns all unstable path variants in canon form.
sourcepub fn stable_paths(
&self,
) -> impl Iterator<Item = (MatrixVersion, &'static str)>
pub fn stable_paths( &self, ) -> impl Iterator<Item = (MatrixVersion, &'static str)>
Returns all stable path variants in canon form, with corresponding Matrix version.
sourcepub fn stable_endpoint_for(
&self,
versions: &[MatrixVersion],
) -> Option<&'static str>
pub fn stable_endpoint_for( &self, versions: &[MatrixVersion], ) -> Option<&'static str>
The path that should be used to query the endpoint, given a series of versions.
This will pick the latest path that the version accepts.
This will return an endpoint in the following format;
/_matrix/client/versions
/_matrix/client/hello/:world
(:world
is a path replacement parameter)
Note: This will not keep in mind endpoint removals, check with
versioning_decision_for
to see if this endpoint
is still available.
Trait Implementations§
source§impl Clone for VersionHistory
impl Clone for VersionHistory
source§fn clone(&self) -> VersionHistory
fn clone(&self) -> VersionHistory
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for VersionHistory
impl Debug for VersionHistory
source§impl PartialEq for VersionHistory
impl PartialEq for VersionHistory
source§fn eq(&self, other: &VersionHistory) -> bool
fn eq(&self, other: &VersionHistory) -> bool
self
and other
values to be equal, and is used
by ==
.impl Eq for VersionHistory
impl StructuralPartialEq for VersionHistory
Auto Trait Implementations§
impl Freeze for VersionHistory
impl RefUnwindSafe for VersionHistory
impl Send for VersionHistory
impl Sync for VersionHistory
impl Unpin for VersionHistory
impl UnwindSafe for VersionHistory
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> CompatExt for T
impl<T> CompatExt for T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more