Add rust lint CI job.
All checks were successful
Check / Check Rust (pull_request) Successful in 21s

This commit is contained in:
Drew 2025-12-13 23:16:33 -08:00
parent 311755c812
commit 4d9c237651
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)
}
}