2016-04-26 12:51:14 -05:00
|
|
|
#![crate_name="issue_3979_traits"]
|
|
|
|
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
|
|
|
|
pub trait Positioned {
|
2017-06-24 21:29:10 -05:00
|
|
|
fn SetX(&mut self, _: isize);
|
2016-04-26 12:51:14 -05:00
|
|
|
fn X(&self) -> isize;
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait Movable: Positioned {
|
|
|
|
fn translate(&mut self, dx: isize) {
|
|
|
|
let x = self.X() + dx;
|
|
|
|
self.SetX(x);
|
|
|
|
}
|
2015-03-18 16:05:24 -05:00
|
|
|
}
|