1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Code generated by fitgen/main.go. DO NOT EDIT.
// Copyright 2025 The RustyFIT Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#![allow(unused, clippy::match_single_binding)]
use std::fmt;
#[derive(Clone, Copy, PartialEq)]
pub struct Checksum(pub u8);
impl Checksum {
/// Allows clear of checksum for flash memory where can only write 1 to 0 without erasing sector.
pub const CLEAR: Checksum = Checksum(0);
/// Set to mark checksum as valid if computes to invalid values 0 or 0xFF. Checksum can also be set to ok to save encoding computation time.
pub const OK: Checksum = Checksum(1);
}
impl Default for Checksum {
fn default() -> Self {
Self(u8::MAX)
}
}
impl fmt::Display for Checksum {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {
0 => write!(f, "clear"),
1 => write!(f, "ok"),
_ => write!(f, "Checksum({})", self.0),
}
}
}
impl fmt::Debug for Checksum {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {
0 => write!(f, "Checksum::CLEAR(0)"),
1 => write!(f, "Checksum::OK(1)"),
_ => write!(f, "Checksum({})", self.0),
}
}
}