tglman / persy
Showing 2 of 3 files from the diff.
Other files ignored by Codecov
Cargo.toml has changed.

@@ -782,7 +782,7 @@
Loading
782 782
mod tests {
783 783
    use super::{Device, DiscRef, MemRef, PageOps, UpdateList};
784 784
    use crate::error::PERes;
785 -
    use byteorder::{ReadBytesExt, WriteBytesExt};
785 +
    use std::io::{Read, Write};
786 786
    use tempfile::Builder;
787 787
788 788
    fn temp_disc_ref(name: &str) -> DiscRef {
@@ -825,13 +825,14 @@
Loading
825 825
        let page = device.create_page(5).unwrap().get_index();
826 826
        {
827 827
            let pg = &mut device.load_page(page).unwrap().clone_write();
828 -
            pg.write_u8(10).unwrap();
828 +
            pg.write_all(&[10]).unwrap();
829 829
            device.flush_page(pg).unwrap();
830 830
        }
831 831
        {
832 832
            let pg = &mut device.load_page(page).unwrap();
833 -
            let va = pg.read_u8().unwrap();
834 -
            assert_eq!(va, 10);
833 +
            let mut data = [0; 1];
834 +
            pg.read_exact(&mut data).unwrap();
835 +
            assert_eq!(data[0], 10);
835 836
            let sz = pg.get_size_exp();
836 837
            assert_eq!(sz, 5);
837 838
        }

@@ -1,5 +1,4 @@
Loading
1 1
use crate::error::PERes;
2 -
use byteorder::{BigEndian, ByteOrder, ReadBytesExt, WriteBytesExt};
3 2
use std::io::{Cursor, Read, Write};
4 3
use unsigned_varint::{encode, io};
5 4
use zigzag::ZigZag;
@@ -306,77 +305,89 @@
Loading
306 305
}
307 306
308 307
pub(crate) fn read_u16(buf: &[u8]) -> u16 {
309 -
    BigEndian::read_u16(buf)
308 +
    let mut value = [0; 2];
309 +
    value[0] = buf[0];
310 +
    value[1] = buf[1];
311 +
    u16::from_be_bytes(value)
310 312
}
311 313
pub(crate) fn write_u16(buf: &mut [u8], val: u16) {
312 -
    BigEndian::write_u16(buf, val)
314 +
    let bv = val.to_be_bytes();
315 +
    buf[0] = bv[0];
316 +
    buf[1] = bv[1];
313 317
}
314 318
pub(crate) fn read_u64(buf: &[u8]) -> u64 {
315 -
    BigEndian::read_u64(buf)
319 +
    let mut value = [0; 8];
320 +
    for p in 0..8 {
321 +
        value[p] = buf[p];
322 +
    }
323 +
    u64::from_be_bytes(value)
316 324
}
317 325
pub(crate) fn write_u64(buf: &mut [u8], val: u64) {
318 -
    BigEndian::write_u64(buf, val)
326 +
    let value = val.to_be_bytes();
327 +
    for p in 0..8 {
328 +
        buf[p] = value[p];
329 +
    }
319 330
}
320 331
321 332
pub(crate) trait WriteFormat: Write {
322 333
    #[inline]
323 334
    fn write_u8(&mut self, value: u8) -> PERes<()> {
324 -
        Ok(WriteBytesExt::write_u8(self, value)?)
335 +
        Ok(self.write_all(&[value])?)
325 336
    }
326 337
327 338
    #[inline]
328 339
    fn write_u16(&mut self, value: u16) -> PERes<()> {
329 -
        Ok(WriteBytesExt::write_u16::<BigEndian>(self, value)?)
340 +
        Ok(self.write_all(&value.to_be_bytes())?)
330 341
    }
331 342
332 343
    #[inline]
333 344
    fn write_u32(&mut self, value: u32) -> PERes<()> {
334 -
        Ok(WriteBytesExt::write_u32::<BigEndian>(self, value)?)
345 +
        Ok(self.write_all(&value.to_be_bytes())?)
335 346
    }
336 347
337 348
    #[inline]
338 349
    fn write_u64(&mut self, value: u64) -> PERes<()> {
339 -
        Ok(WriteBytesExt::write_u64::<BigEndian>(self, value)?)
350 +
        Ok(self.write_all(&value.to_be_bytes())?)
340 351
    }
341 352
342 353
    #[inline]
343 354
    fn write_u128(&mut self, value: u128) -> PERes<()> {
344 -
        Ok(WriteBytesExt::write_u128::<BigEndian>(self, value)?)
355 +
        Ok(self.write_all(&value.to_be_bytes())?)
345 356
    }
346 357
347 358
    #[inline]
348 359
    fn write_i8(&mut self, value: i8) -> PERes<()> {
349 -
        Ok(WriteBytesExt::write_i8(self, value)?)
360 +
        Ok(self.write_all(&value.to_be_bytes())?)
350 361
    }
351 362
352 363
    #[inline]
353 364
    fn write_i16(&mut self, value: i16) -> PERes<()> {
354 -
        Ok(WriteBytesExt::write_i16::<BigEndian>(self, value)?)
365 +
        Ok(self.write_all(&value.to_be_bytes())?)
355 366
    }
356 367
357 368
    #[inline]
358 369
    fn write_i32(&mut self, value: i32) -> PERes<()> {
359 -
        Ok(WriteBytesExt::write_i32::<BigEndian>(self, value)?)
370 +
        Ok(self.write_all(&value.to_be_bytes())?)
360 371
    }
361 372
362 373
    #[inline]
363 374
    fn write_i64(&mut self, value: i64) -> PERes<()> {
364 -
        Ok(WriteBytesExt::write_i64::<BigEndian>(self, value)?)
375 +
        Ok(self.write_all(&value.to_be_bytes())?)
365 376
    }
366 377
367 378
    #[inline]
368 379
    fn write_i128(&mut self, value: i128) -> PERes<()> {
369 -
        Ok(WriteBytesExt::write_i128::<BigEndian>(self, value)?)
380 +
        Ok(self.write_all(&value.to_be_bytes())?)
370 381
    }
371 382
372 383
    #[inline]
373 384
    fn write_f32(&mut self, value: f32) -> PERes<()> {
374 -
        Ok(WriteBytesExt::write_f32::<BigEndian>(self, value)?)
385 +
        Ok(self.write_all(&value.to_be_bytes())?)
375 386
    }
376 387
377 388
    #[inline]
378 389
    fn write_f64(&mut self, value: f64) -> PERes<()> {
379 -
        Ok(WriteBytesExt::write_f64::<BigEndian>(self, value)?)
390 +
        Ok(self.write_all(&value.to_be_bytes())?)
380 391
    }
381 392
}
382 393
@@ -385,62 +396,86 @@
Loading
385 396
pub(crate) trait ReadFormat: Read {
386 397
    #[inline]
387 398
    fn read_u8(&mut self) -> PERes<u8> {
388 -
        Ok(ReadBytesExt::read_u8(self)?)
399 +
        let mut buf = [0; 1];
400 +
        self.read_exact(&mut buf)?;
401 +
        Ok(buf[0])
389 402
    }
390 403
391 404
    #[inline]
392 405
    fn read_u16(&mut self) -> PERes<u16> {
393 -
        Ok(ReadBytesExt::read_u16::<BigEndian>(self)?)
406 +
        let mut buf = [0; 2];
407 +
        self.read_exact(&mut buf)?;
408 +
        Ok(u16::from_be_bytes(buf))
394 409
    }
395 410
396 411
    #[inline]
397 412
    fn read_u32(&mut self) -> PERes<u32> {
398 -
        Ok(ReadBytesExt::read_u32::<BigEndian>(self)?)
413 +
        let mut buf = [0; 4];
414 +
        self.read_exact(&mut buf)?;
415 +
        Ok(u32::from_be_bytes(buf))
399 416
    }
400 417
401 418
    #[inline]
402 419
    fn read_u64(&mut self) -> PERes<u64> {
403 -
        Ok(ReadBytesExt::read_u64::<BigEndian>(self)?)
420 +
        let mut buf = [0; 8];
421 +
        self.read_exact(&mut buf)?;
422 +
        Ok(u64::from_be_bytes(buf))
404 423
    }
405 424
406 425
    #[inline]
407 426
    fn read_u128(&mut self) -> PERes<u128> {
408 -
        Ok(ReadBytesExt::read_u128::<BigEndian>(self)?)
427 +
        let mut buf = [0; 16];
428 +
        self.read_exact(&mut buf)?;
429 +
        Ok(u128::from_be_bytes(buf))
409 430
    }
410 431
411 432
    #[inline]
412 433
    fn read_i8(&mut self) -> PERes<i8> {
413 -
        Ok(ReadBytesExt::read_i8(self)?)
434 +
        let mut buf = [0; 1];
435 +
        self.read_exact(&mut buf)?;
436 +
        Ok(buf[0] as i8)
414 437
    }
415 438
416 439
    #[inline]
417 440
    fn read_i16(&mut self) -> PERes<i16> {
418 -
        Ok(ReadBytesExt::read_i16::<BigEndian>(self)?)
441 +
        let mut buf = [0; 2];
442 +
        self.read_exact(&mut buf)?;
443 +
        Ok(i16::from_be_bytes(buf))
419 444
    }
420 445
421 446
    #[inline]
422 447
    fn read_i32(&mut self) -> PERes<i32> {
423 -
        Ok(ReadBytesExt::read_i32::<BigEndian>(self)?)
448 +
        let mut buf = [0; 4];
449 +
        self.read_exact(&mut buf)?;
450 +
        Ok(i32::from_be_bytes(buf))
424 451
    }
425 452
426 453
    #[inline]
427 454
    fn read_i64(&mut self) -> PERes<i64> {
428 -
        Ok(ReadBytesExt::read_i64::<BigEndian>(self)?)
455 +
        let mut buf = [0; 8];
456 +
        self.read_exact(&mut buf)?;
457 +
        Ok(i64::from_be_bytes(buf))
429 458
    }
430 459
431 460
    #[inline]
432 461
    fn read_i128(&mut self) -> PERes<i128> {
433 -
        Ok(ReadBytesExt::read_i128::<BigEndian>(self)?)
462 +
        let mut buf = [0; 16];
463 +
        self.read_exact(&mut buf)?;
464 +
        Ok(i128::from_be_bytes(buf))
434 465
    }
435 466
436 467
    #[inline]
437 468
    fn read_f32(&mut self) -> PERes<f32> {
438 -
        Ok(ReadBytesExt::read_f32::<BigEndian>(self)?)
469 +
        let mut buf = [0; 4];
470 +
        self.read_exact(&mut buf)?;
471 +
        Ok(f32::from_be_bytes(buf))
439 472
    }
440 473
441 474
    #[inline]
442 475
    fn read_f64(&mut self) -> PERes<f64> {
443 -
        Ok(ReadBytesExt::read_f64::<BigEndian>(self)?)
476 +
        let mut buf = [0; 8];
477 +
        self.read_exact(&mut buf)?;
478 +
        Ok(f64::from_be_bytes(buf))
444 479
    }
445 480
}
446 481
Files Coverage
src 91.70%
tests 98.71%
Project Totals (37 files) 93.07%
Notifications are pending CI completion. Waiting for GitLab's status webhook to queue notifications. Push notifications now.
1
coverage:
2
  status:
3
    project:
4
      default:
5
        target: 80%
6
        threshold: 1.0%
7
    patch: off
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading