Add rust lint CI job. (#9)
All checks were successful
Check / Check Rust (push) Successful in 20s

Additionally fix the many lint errors that are occurring. (or disable them).

Reviewed-on: #9
Co-authored-by: Drew Galbraith <drew@tiramisu.one>
Co-committed-by: Drew Galbraith <drew@tiramisu.one>
This commit is contained in:
Drew 2025-12-14 09:02:59 +00:00 committed by Drew
parent 311755c812
commit 1a48911745
30 changed files with 177 additions and 108 deletions

View file

@ -5,12 +5,19 @@ pub struct ByteBuffer<const N: usize> {
buffer: Box<[u8; N]>,
}
impl<const N: usize> ByteBuffer<N> {
pub fn new() -> Self {
impl<const N: usize> Default for ByteBuffer<N> {
fn default() -> Self {
Self {
buffer: Box::new([0; N]),
}
}
}
impl<const N: usize> ByteBuffer<N> {
pub fn new() -> Self {
ByteBuffer::default()
}
pub fn size(&self) -> u64 {
N as u64
}
@ -54,7 +61,7 @@ impl<const N: usize> ByteBuffer<N> {
if (len + offset) > N {
return Err(ZError::BUFFER_SIZE);
}
Ok(alloc::str::from_utf8(&self.buffer[offset..offset + len])
.map_err(|_| ZError::INVALID_ARGUMENT)?)
alloc::str::from_utf8(&self.buffer[offset..offset + len])
.map_err(|_| ZError::INVALID_ARGUMENT)
}
}