]>
git.proxmox.com Git - rustc.git/blob - src/test/run-pass/traits/trait-bounds.rs
1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
13 #![allow(non_camel_case_types)]
14 #![allow(non_snake_case)]
17 fn read(&self) -> isize;
20 trait connection_factory
<C
:connection
> {
21 fn create(&self) -> C
;
24 type my_connection
= ();
25 type my_connection_factory
= ();
27 impl connection
for () {
28 fn read(&self) -> isize { 43 }
31 impl connection_factory
<my_connection
> for my_connection_factory
{
32 fn create(&self) -> my_connection { () }
37 let connection
= factory
.create();
38 let result
= connection
.read();
39 assert_eq
!(result
, 43);