Updated the Rust version used by the CI/CD and silenced clippy's missing_errors_doc lint
Check, format and test / build (push) Successful in 1m13s
Check, format and test / build (push) Successful in 1m13s
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
container: docker.io/rust:1.79.0-alpine3.20
|
container: docker.io/rust:1.98.1-alpine3.24
|
||||||
steps:
|
steps:
|
||||||
- name: Install the dependencies
|
- name: Install the dependencies
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# R701 🕰️
|
# R701 🕰️
|
||||||
|
|
||||||
[](https://www.rust-lang.org)
|
[](https://www.rust-lang.org)
|
||||||
[](https://brainmade.org)
|
[](https://claude.com/product/claude-code)
|
||||||
[](https://choosealicense.com/licenses/agpl-3.0)
|
[](https://choosealicense.com/licenses/agpl-3.0)
|
||||||
[](https://buymeacoffee.com/nicolabelluti)
|
[](https://buymeacoffee.com/nicolabelluti)
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
+8
-1
@@ -9,6 +9,7 @@ pub struct R701 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl R701 {
|
impl R701 {
|
||||||
|
#[allow(clippy::missing_errors_doc)]
|
||||||
pub fn connect(connection_info: impl ToSocketAddrs) -> Result<Self> {
|
pub fn connect(connection_info: impl ToSocketAddrs) -> Result<Self> {
|
||||||
// Create a new R701 struct
|
// Create a new R701 struct
|
||||||
let mut new = Self {
|
let mut new = Self {
|
||||||
@@ -21,6 +22,7 @@ impl R701 {
|
|||||||
Ok(new)
|
Ok(new)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::missing_errors_doc)]
|
||||||
pub fn request(&mut self, payload: &[u8; 12]) -> Result<Vec<u8>> {
|
pub fn request(&mut self, payload: &[u8; 12]) -> Result<Vec<u8>> {
|
||||||
// Create a blank request
|
// Create a blank request
|
||||||
let mut request = [0x55, 0xaa, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
let mut request = [0x55, 0xaa, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||||
@@ -40,6 +42,7 @@ impl R701 {
|
|||||||
Ok(buffer.fill_buf()?.to_vec())
|
Ok(buffer.fill_buf()?.to_vec())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::missing_errors_doc)]
|
||||||
pub fn ping(&mut self) -> Result<()> {
|
pub fn ping(&mut self) -> Result<()> {
|
||||||
// Create a request with a payload of `01 80 00 00 00 00 00 00 00 00 00
|
// Create a request with a payload of `01 80 00 00 00 00 00 00 00 00 00
|
||||||
// 00` and get the response
|
// 00` and get the response
|
||||||
@@ -54,6 +57,7 @@ impl R701 {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::missing_errors_doc)]
|
||||||
pub fn get_name(&mut self, id: u32) -> Result<Option<String>> {
|
pub fn get_name(&mut self, id: u32) -> Result<Option<String>> {
|
||||||
// Create a request with a payload of `01 c7 xx xx xx xx 00 00 00 00 14
|
// Create a request with a payload of `01 c7 xx xx xx xx 00 00 00 00 14
|
||||||
// 00`, where `xx xx xx xx` is the employee ID in little endian
|
// 00`, where `xx xx xx xx` is the employee ID in little endian
|
||||||
@@ -89,6 +93,7 @@ impl R701 {
|
|||||||
Ok(Some(name).filter(|name| !name.is_empty()))
|
Ok(Some(name).filter(|name| !name.is_empty()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::missing_errors_doc)]
|
||||||
pub fn get_total_record_count(&mut self) -> Result<u16> {
|
pub fn get_total_record_count(&mut self) -> Result<u16> {
|
||||||
// Create a request with a payload of `01 b4 08 00 00 00 00 00 ff ff 00
|
// Create a request with a payload of `01 b4 08 00 00 00 00 00 ff ff 00
|
||||||
// 00` and get the response
|
// 00` and get the response
|
||||||
@@ -109,6 +114,7 @@ impl R701 {
|
|||||||
Ok(u16::from_le_bytes(record_count_le))
|
Ok(u16::from_le_bytes(record_count_le))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::missing_errors_doc)]
|
||||||
pub fn get_record_bytes(
|
pub fn get_record_bytes(
|
||||||
&mut self,
|
&mut self,
|
||||||
total_records: u16,
|
total_records: u16,
|
||||||
@@ -146,7 +152,8 @@ impl R701 {
|
|||||||
Ok(response[12..1036].to_vec())
|
Ok(response[12..1036].to_vec())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn into_record_iter(&mut self) -> Result<RecordIterator> {
|
#[allow(clippy::missing_errors_doc)]
|
||||||
|
pub fn into_record_iter(&mut self) -> Result<RecordIterator<'_>> {
|
||||||
RecordIterator::from(self)
|
RecordIterator::from(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ pub struct RecordIterator<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> RecordIterator<'a> {
|
impl<'a> RecordIterator<'a> {
|
||||||
|
#[allow(clippy::missing_errors_doc)]
|
||||||
pub fn from(r701: &'a mut R701) -> Result<Self> {
|
pub fn from(r701: &'a mut R701) -> Result<Self> {
|
||||||
// Get the total number of records
|
// Get the total number of records
|
||||||
let total_records = r701.get_total_record_count()?;
|
let total_records = r701.get_total_record_count()?;
|
||||||
@@ -44,7 +45,7 @@ impl<'a> RecordIterator<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Iterator for RecordIterator<'a> {
|
impl Iterator for RecordIterator<'_> {
|
||||||
type Item = Record;
|
type Item = Record;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
|
|||||||
Reference in New Issue
Block a user