Support pre-release servers (#3094)

This commit is contained in:
Rushmore Mushambi 2023-12-08 11:18:38 +02:00 committed by GitHub
parent daf02dc4e6
commit 846282f5ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,7 +28,7 @@ use std::sync::OnceLock;
/// A specialized `Result` type /// A specialized `Result` type
pub type Result<T> = std::result::Result<T, crate::Error>; pub type Result<T> = std::result::Result<T, crate::Error>;
const SUPPORTED_VERSIONS: (&str, &str) = (">=1.0.0-beta.9, <2.0.0", "20230701.55918b7c"); const SUPPORTED_VERSIONS: (&str, &str) = (">=1.0.0, <2.0.0", "20230701.55918b7c");
/// Connection trait implemented by supported engines /// Connection trait implemented by supported engines
pub trait Connection: conn::Connection {} pub trait Connection: conn::Connection {}
@ -143,7 +143,9 @@ where
// invalid version requirements should be caught during development // invalid version requirements should be caught during development
let req = VersionReq::parse(versions).expect("valid supported versions"); let req = VersionReq::parse(versions).expect("valid supported versions");
let build_meta = BuildMetadata::new(build_meta).expect("valid supported build metadata"); let build_meta = BuildMetadata::new(build_meta).expect("valid supported build metadata");
let version = self.version().await?; let mut version = self.version().await?;
// we would like to be able to connect to pre-releases too
version.pre = Default::default();
let server_build = &version.build; let server_build = &version.build;
if !req.matches(&version) { if !req.matches(&version) {
return Err(Error::VersionMismatch { return Err(Error::VersionMismatch {