imdl 0.1.16

📦 A 40' shipping container for the internet
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::common::*;

// Intermodal, or at least parts of it, might eventually be ported to
// 16-bit systems, but for now let's assume that usize is at least 32
// bits, and document that assumption with this assert.
const_assert!(std::mem::size_of::<usize>() >= std::mem::size_of::<u32>());

pub(crate) trait IntoUsize {
  fn into_usize(self) -> usize;
}

impl IntoUsize for u32 {
  fn into_usize(self) -> usize {
    #![allow(clippy::as_conversions)]
    self as usize
  }
}