Skip to content

Instantly share code, notes, and snippets.

@nikomatsakis
Created September 22, 2017 09:05
Show Gist options
  • Save nikomatsakis/2006df6ab7dc692cff798350066955e8 to your computer and use it in GitHub Desktop.
Save nikomatsakis/2006df6ab7dc692cff798350066955e8 to your computer and use it in GitHub Desktop.
// Some basic examples you can use with the repl. Try this
// (you type the parts that go after the `?-`):
//
// cargo run
// ?- load libstd.chalk
// ?- Vec<Box<i32>>: Clone
trait AsRef<T> { }
trait Clone { }
trait Copy where Self: Clone { }
trait Sized { }
struct i32 { }
impl Copy for i32 { }
impl Clone for i32 { }
impl Sized for i32 { }
struct u32 { }
impl Copy for u32 { }
impl Clone for u32 { }
impl Sized for u32 { }
struct Rc<T> { }
impl<T> Clone for Rc<T> { }
impl<T> Sized for Rc<T> { }
struct Box<T> { }
impl<T> AsRef<T> for Box<T> where T: Sized { }
impl<T> Clone for Box<T> where T: Clone { }
impl<T> Sized for Box<T> { }
// Meant to be [T]
struct Slice<T> where T: Sized { }
impl<T> Sized for Slice<T> { }
impl<T> AsRef<Slice<T>> for Slice<T> where T: Sized { }
struct Vec<T> where T: Sized { }
impl<T> AsRef<Slice<T>> for Vec<T> where T: Sized { }
impl<T> AsRef<Vec<T>> for Vec<T> where T: Sized { }
impl<T> Clone for Vec<T> where T: Clone, T: Sized { }
impl<T> Sized for Vec<T> where T: Sized { }
trait SliceExt
where <Self as SliceExt>::Item: Clone
{
type Item;
}
impl<T> SliceExt for Slice<T>
where T: Clone
{
type Item = T;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment