Created
June 7, 2013 02:15
-
-
Save SiegeLord/5726643 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
struct Axes2D; | |
impl Axes2D | |
{ | |
fn new() -> Axes2D | |
{ | |
Axes2D | |
} | |
} | |
struct Axes3D; | |
impl Axes3D | |
{ | |
fn new() -> Axes2D | |
{ | |
Axes2D | |
} | |
} | |
enum AxesVariant | |
{ | |
Axes2DType(Axes2D), | |
Axes3DType(Axes3D) | |
} | |
impl AxesVariant | |
{ | |
fn command(self) -> &'static str | |
{ | |
match self | |
{ | |
Axes2DType(_) => "plot", | |
Axes3DType(_) => "splot", | |
} | |
} | |
} | |
struct Figure | |
{ | |
priv axes: ~[AxesVariant] | |
} | |
impl Figure | |
{ | |
fn new() -> Figure | |
{ | |
Figure | |
{ | |
axes: ~[] | |
} | |
} | |
fn axes2d<'l>(&'l mut self) -> &'l mut Axes2D | |
{ | |
self.axes.push(Axes2DType(Axes2D::new())); | |
match self.axes[0] | |
{ | |
Axes2DType(ref mut a) => a, | |
_ => fail!() | |
} | |
} | |
} | |
fn main() | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment