Last active
September 22, 2016 22:48
-
-
Save JoeyEremondi/c818d465715f81d662be1cea88fa982e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::boxed::Box; | |
use std::rc::Rc; | |
use std::borrow::Borrow; | |
use std::mem; | |
struct BP_Borrow; | |
struct BP_RC; | |
trait BorrowPlus<Borrowed, TRef> : Borrow<Borrowed> | |
{ | |
} | |
fn asRc<Borrowed, BorrowType>(val : BorrowType) -> Rc<Borrowed> | |
where BorrowType : BorrowPlus<Borrowed, BP_RC> | |
{ | |
unsafe { mem::transmute::<BorrowType, Rc<Borrowed> > (val)} | |
} | |
fn main(){} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment