blob: 4d5ec6de39219540cdfaf90e788309428095ca1b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#![crate_type="lib"]
pub struct Struct {
pub x: isize
}
impl Struct {
fn static_meth_struct() -> Struct {
Struct { x: 1 }
}
fn meth_struct(&self) -> isize {
self.x
}
}
pub enum Enum {
Variant1(isize),
Variant2(isize)
}
impl Enum {
fn static_meth_enum() -> Enum {
Enum::Variant2(10)
}
fn meth_enum(&self) -> isize {
match *self {
Enum::Variant1(x) |
Enum::Variant2(x) => x
}
}
}
|