pub struct SupportedApi { /* private fields */ }Expand description
A version the client implements.
Implementations§
Source§impl SupportedApi
impl SupportedApi
Sourcepub fn from_versions<I, S>(values: I) -> Result<Self, ModelError>
pub fn from_versions<I, S>(values: I) -> Result<Self, ModelError>
Sourcepub fn with_lenient(self, lenient: bool) -> Self
pub fn with_lenient(self, lenient: bool) -> Self
Accept any advertised stable version with the same major as a supported one.
Off by default (exact precedence match). When on, 1.0.1 and 1.1.0
are selected for a client that supports 1.0.0 (a pre-release such as
1.1.0-rc.1 is not), exact matches sort before same-major ones in
select_endpoints, and callers should
parse documents with ApiVersion::parse_lenient so short forms such
as 1 are accepted. Risk: the models were checked against the
pinned 1.0.0 schemas only; a compatible-looking server may send
responses this client cannot read or reads wrongly. Major version 0
is never matched by major alone.
Sourcepub fn is_lenient(&self) -> bool
pub fn is_lenient(&self) -> bool
Whether lenient version matching is on.
Sourcepub fn supports(&self, advertised: &Version) -> bool
pub fn supports(&self, advertised: &Version) -> bool
Whether an advertised version is implemented.
SemVer build metadata is ignored. Prerelease identifiers are not. In lenient mode a stable version with the same major as a supported one is also accepted; a pre-release is accepted only on an exact match.