pub struct Mismatch {
pub riff: Option<Build>,
pub server: Option<Build>,
pub seen: Option<String>,
}Expand description
riff and its riff-server cannot talk
(01M3MX1E65XGWDZ062PQ9YXQ5T). None is a side that sent no build,
or a build of an older form.
Fields§
§riff: Option<Build>The build of riff.
server: Option<Build>The build of riff-server.
seen: Option<String>What riff saw of a reply that named no build: its status and
URL, for example status 200 OK from http://127.0.0.1:7878/v1/who
(01M3QCMJ9F1GRTRRSB4AW9TC3D). None on the side of the server.
Implementations§
Source§impl Mismatch
impl Mismatch
Sourcepub fn older(&self) -> Side
pub fn older(&self) -> Side
The side to update: the older version. A side with no build is older.
use riff_core::build::{Build, Mismatch, Side};
let b = |v: &str| Some(Build { version: v.into(), ..Build::this() });
let m = |riff, server| Mismatch { riff, server, seen: None }.older();
assert_eq!(m(b("0.2.0"), b("0.4.0")), Side::Riff);
assert_eq!(m(b("0.4.0"), b("0.3.2")), Side::Server);
assert_eq!(m(b("0.4.0"), None), Side::Server);
assert_eq!(m(None, b("0.4.0")), Side::Riff);Trait Implementations§
Source§impl Display for Mismatch
impl Display for Mismatch
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
use riff_core::build::{Build, Mismatch, UPDATE_URL};
// A riff two lines before this server.
let server = Build::this();
let line = server.semver().unwrap();
let before = line.line_before().unwrap();
let two = Build {
version: before.line_before().unwrap().to_string(),
..Build::this()
};
let m = Mismatch { riff: Some(two.clone()), server: Some(server.clone()), seen: None };
assert_eq!(
m.to_string(),
format!(
"this riff ({two}) and its riff-server ({server}) do not match. riff-server {} \
talks only with riff {} and {}. Update riff on this machine, then start your \
sessions again. See {UPDATE_URL}",
line.line(),
line.line(),
before.line()
)
);
let old = Mismatch { riff: m.riff.clone(), server: None, seen: None };
assert!(old.to_string().contains("riff-server (an older build)"), "{old}");
assert!(old.to_string().contains("Update riff-server"), "{old}");
// riff names what it saw of a reply with no build.
let seen = Some("status 200 OK from http://127.0.0.1:7878/v1/who".to_string());
let old = Mismatch { seen, ..old };
assert!(
old.to_string().contains(
"its riff-server (no riff build in the reply: status 200 OK from \
http://127.0.0.1:7878/v1/who) do not match"
),
"{old}"
);Source§impl Error for Mismatch
impl Error for Mismatch
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
impl Eq for Mismatch
impl StructuralPartialEq for Mismatch
Auto Trait Implementations§
impl Freeze for Mismatch
impl RefUnwindSafe for Mismatch
impl Send for Mismatch
impl Sync for Mismatch
impl Unpin for Mismatch
impl UnsafeUnpin for Mismatch
impl UnwindSafe for Mismatch
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.