Let ≡n
be the equivalence class of nominally equivalent types.
A ≡n B
denotes that A
and B
are nominally the same type.
{ foo: T, bar: U } ≡n { bar: U, foo: T } // Order does not matter.
//****************************************************************************** | |
// "const_trait_system" | |
//****************************************************************************** | |
/* | |
Dependency DAG of proposal: | |
[A, B] -> [] | |
[C] -> [B] and/or [A] -- NOTE: C is moot without B or A. | |
[D, E] -> [B] |
fn main() { | |
use std::mem::{size_of, size_of_val}; | |
let susize = size_of::<usize>(); | |
// usize is size_t. | |
// "hello" is in static memory, x is on the stack and like: (char*, usize). | |
// &'static str is a fat pointer. | |
// It is not null terminated. |
(.$) :: (t -> b -> c) -> (a -> b) -> t -> a -> c | |
(.$) f g a = f a . g | |
infixr 8 .$ | |
-- | '.|': Compose an unary function with a binary function. | |
-- from: http://hackage.haskell.org/package/pointless-fun-1.1.0.5/docs/Data-Function-Pointless.html | |
(.|) :: (b -> c) -> (t -> a -> b) -> t -> a -> c | |
(.|) f g a = f . g a | |
infixr 7 .| |
I hereby claim:
To claim this, I am signing this object:
#![feature(alloc, heap_api)] | |
extern crate alloc; | |
use std::rc::Rc; | |
use std::mem::{align_of, align_of_val, size_of, size_of_val}; | |
fn to_rc<T: ?Sized>(b: Box<T>) -> Rc<T> { | |
// super duper undefined behavior! | |
struct InnerRcBox<T: ?Sized> { | |
strong: usize, |
#![feature(try_from)] | |
use std::str::FromStr; | |
use std::convert::TryFrom; | |
macro_rules! str_to_enum { | |
($typ: path, $($var: ident),+) => { | |
impl std::str::FromStr for $typ { | |
type Err = (); | |
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> { |
// For debugging purposes: | |
impl<I, O, E=u32> IResult<I, O, E> { | |
fn map_rem<R, F: FnOnce(I) -> R>(self, f: F) -> IResult<R, O, E> { | |
use IResult::*; | |
match s { | |
Done(i, o) => Done(f(i), o), | |
Error(e) => Error(e), | |
Incomplete(n) => Incomplete(n), | |
} |