Crate deranged

Source
Expand description

deranged is a proof-of-concept implementation of ranged integers.

Modulesยง

  • traits ๐Ÿ”’
    Declaration and implementation of traits used for const assertions.
  • unsafe_wrapper ๐Ÿ”’
    Declaration and implementation of Unsafe, which ensures all unsafe operations are correctly placed in unsafe blocks.

Macrosยง

  • article ๐Ÿ”’
    "A" if true, "An" if false.
  • const_try_opt ๐Ÿ”’
    ? for Option types, usable in const contexts.
  • Output the provided code if and only if the list does not include rand_09.
  • if_signed ๐Ÿ”’
    Output the given tokens if the type is signed, otherwise output nothing.
  • if_unsigned ๐Ÿ”’
    Output the given tokens if the type is unsigned, otherwise output nothing.
  • impl_ranged ๐Ÿ”’
    Implement a ranged integer type.
  • Option::unwrap_unchecked, but usable in const contexts.

Structsยง

  • An optional RangedI8; similar to Option<RangedI8> with better optimization.
  • An optional RangedI16; similar to Option<RangedI16> with better optimization.
  • An optional RangedI32; similar to Option<RangedI32> with better optimization.
  • An optional RangedI64; similar to Option<RangedI64> with better optimization.
  • An optional RangedI128; similar to Option<RangedI128> with better optimization.
  • An optional RangedIsize; similar to Option<RangedIsize> with better optimization.
  • An optional RangedU8; similar to Option<RangedU8> with better optimization.
  • An optional RangedU16; similar to Option<RangedU16> with better optimization.
  • An optional RangedU32; similar to Option<RangedU32> with better optimization.
  • An optional RangedU64; similar to Option<RangedU64> with better optimization.
  • An optional RangedU128; similar to Option<RangedU128> with better optimization.
  • An optional RangedUsize; similar to Option<RangedUsize> with better optimization.
  • An error which can be returned when parsing an integer.
  • An i8 that is known to be in the range MIN..=MAX.
  • An i16 that is known to be in the range MIN..=MAX.
  • An i32 that is known to be in the range MIN..=MAX.
  • An i64 that is known to be in the range MIN..=MAX.
  • An i128 that is known to be in the range MIN..=MAX.
  • An isize that is known to be in the range MIN..=MAX.
  • A u8 that is known to be in the range MIN..=MAX.
  • A u16 that is known to be in the range MIN..=MAX.
  • A u32 that is known to be in the range MIN..=MAX.
  • A u64 that is known to be in the range MIN..=MAX.
  • A u128 that is known to be in the range MIN..=MAX.
  • A usize that is known to be in the range MIN..=MAX.
  • The error type returned when a checked integral type conversion fails.

Functionsยง

  • assert_unchecked ๐Ÿ”’ โš 
    Informs the optimizer that a condition is always true. If the condition is false, the behavior is undefined.