2015-11-09 19:03:01 +00:00
|
|
|
// rustfmt-wrap_comments: true
|
2017-02-19 18:57:02 +00:00
|
|
|
// rustfmt-error_on_line_overflow: false
|
2015-05-29 10:41:26 +00:00
|
|
|
// Enums test
|
|
|
|
|
|
|
|
#[atrr]
|
|
|
|
pub enum Test {
|
|
|
|
A,
|
2015-06-23 13:58:58 +00:00
|
|
|
B(u32, A /* comment */, SomeType),
|
2015-05-29 10:41:26 +00:00
|
|
|
/// Doc comment
|
|
|
|
C,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub enum Foo<'a, Y: Baz>
|
2017-06-12 04:01:41 +00:00
|
|
|
where
|
|
|
|
X: Whatever,
|
2015-05-29 10:41:26 +00:00
|
|
|
{
|
|
|
|
A,
|
|
|
|
}
|
|
|
|
|
|
|
|
enum EmtpyWithComment {
|
|
|
|
// Some comment
|
|
|
|
}
|
|
|
|
|
|
|
|
// C-style enum
|
|
|
|
enum Bar {
|
|
|
|
A = 1,
|
2017-08-11 08:54:20 +00:00
|
|
|
#[someAttr(test)] B = 2, // comment
|
2015-05-29 10:41:26 +00:00
|
|
|
C,
|
|
|
|
}
|
|
|
|
|
|
|
|
enum LongVariants {
|
2017-06-12 04:01:41 +00:00
|
|
|
First(
|
|
|
|
LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOONG, // comment
|
2017-06-23 16:12:58 +00:00
|
|
|
VARIANT,
|
2017-06-12 04:01:41 +00:00
|
|
|
),
|
2015-05-29 10:41:26 +00:00
|
|
|
// This is the second variant
|
|
|
|
Second,
|
|
|
|
}
|
2015-06-23 13:58:58 +00:00
|
|
|
|
|
|
|
enum StructLikeVariants {
|
|
|
|
Normal(u32, String),
|
|
|
|
StructLike {
|
|
|
|
x: i32, // Test comment
|
|
|
|
// Pre-comment
|
2017-08-11 08:54:20 +00:00
|
|
|
#[Attr50] y: SomeType, // Aanother Comment
|
2015-07-01 18:49:45 +00:00
|
|
|
},
|
2016-05-18 20:38:49 +00:00
|
|
|
SL { a: A },
|
2015-06-23 13:58:58 +00:00
|
|
|
}
|
2015-09-27 15:23:37 +00:00
|
|
|
|
|
|
|
enum X {
|
2017-06-12 04:01:41 +00:00
|
|
|
CreateWebGLPaintTask(
|
|
|
|
Size2D<i32>,
|
|
|
|
GLContextAttributes,
|
2017-06-23 16:12:58 +00:00
|
|
|
IpcSender<Result<(IpcSender<CanvasMsg>, usize), String>>,
|
2017-06-12 04:01:41 +00:00
|
|
|
), // This is a post comment
|
2015-10-07 23:23:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub enum EnumWithAttributes {
|
|
|
|
// This is a pre comment
|
|
|
|
// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
|
TupleVar(usize, usize, usize), /* AAAA AAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
|
* AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA */
|
|
|
|
// Pre Comment
|
|
|
|
#[rustfmt_skip]
|
|
|
|
SkippedItem(String,String,), // Post-comment
|
|
|
|
#[another_attr]
|
|
|
|
#[attr2]
|
2016-05-18 20:38:49 +00:00
|
|
|
ItemStruct { x: usize, y: usize }, /* Comment AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA */
|
2015-10-07 23:23:07 +00:00
|
|
|
// And another
|
|
|
|
ForcedPreflight, /* AAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
|
* AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA */
|
|
|
|
}
|
|
|
|
|
|
|
|
pub enum SingleTuple {
|
|
|
|
// Pre Comment AAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
|
// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
2017-01-06 03:35:28 +00:00
|
|
|
Match(usize, usize, String), /* Post-comment AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA */
|
2015-10-07 23:23:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub enum SingleStruct {
|
2016-05-18 20:38:49 +00:00
|
|
|
Match { name: String, loc: usize }, // Post-comment
|
2015-10-07 23:23:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub enum GenericEnum<I, T>
|
2017-06-12 04:01:41 +00:00
|
|
|
where
|
|
|
|
I: Iterator<Item = T>,
|
2015-10-07 23:23:07 +00:00
|
|
|
{
|
|
|
|
// Pre Comment
|
2017-07-05 16:03:20 +00:00
|
|
|
Left { list: I, root: T }, // Post-comment
|
2016-05-18 20:38:49 +00:00
|
|
|
Right { list: I, root: T }, // Post Comment
|
2015-10-07 23:23:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enum EmtpyWithComment {
|
|
|
|
// Some comment
|
|
|
|
}
|
|
|
|
|
|
|
|
enum TestFormatFails {
|
2017-08-11 08:54:20 +00:00
|
|
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
|
2015-10-07 23:23:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn nested_enum_test() {
|
|
|
|
if true {
|
|
|
|
enum TestEnum {
|
2017-06-12 04:01:41 +00:00
|
|
|
One(
|
2015-10-07 23:23:07 +00:00
|
|
|
usize,
|
|
|
|
usize,
|
|
|
|
usize,
|
|
|
|
usize,
|
|
|
|
usize,
|
|
|
|
usize,
|
|
|
|
usize,
|
|
|
|
usize,
|
|
|
|
usize,
|
|
|
|
usize,
|
|
|
|
usize,
|
|
|
|
usize,
|
|
|
|
usize,
|
|
|
|
usize,
|
2017-06-12 04:01:41 +00:00
|
|
|
usize,
|
2017-06-23 16:12:58 +00:00
|
|
|
usize,
|
2017-06-12 04:01:41 +00:00
|
|
|
), /* AAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
|
* AAAAAAAAAAAAAAAAAAAAAA */
|
2015-10-07 23:23:07 +00:00
|
|
|
Two, /* AAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
|
* AAAAAAAAAAAAAAAAAA */
|
|
|
|
}
|
|
|
|
enum TestNestedFormatFail {
|
2017-08-11 08:54:20 +00:00
|
|
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
|
2015-10-07 23:23:07 +00:00
|
|
|
}
|
|
|
|
}
|
2015-09-27 15:23:37 +00:00
|
|
|
}
|
2015-10-18 22:25:38 +00:00
|
|
|
|
|
|
|
pub struct EmtpyWithComment {
|
|
|
|
// FIXME: Implement this struct
|
|
|
|
}
|
2017-06-04 14:27:21 +00:00
|
|
|
|
|
|
|
// #1115
|
|
|
|
pub enum Bencoding<'i> {
|
|
|
|
Str(&'i [u8]),
|
|
|
|
Int(i64),
|
|
|
|
List(Vec<Bencoding<'i>>),
|
2017-11-08 09:24:18 +00:00
|
|
|
/// A bencoded dict value. The first element the slice of bytes in the source that the dict is
|
2017-06-04 14:27:21 +00:00
|
|
|
/// composed of. The second is the dict, decoded into an ordered map.
|
|
|
|
// TODO make Dict "structlike" AKA name the two values.
|
|
|
|
Dict(&'i [u8], BTreeMap<&'i [u8], Bencoding<'i>>),
|
|
|
|
}
|
2017-06-05 14:21:39 +00:00
|
|
|
|
|
|
|
// #1261
|
|
|
|
pub enum CoreResourceMsg {
|
2017-06-12 04:01:41 +00:00
|
|
|
SetCookieForUrl(
|
|
|
|
ServoUrl,
|
|
|
|
#[serde(deserialize_with = "::hyper_serde::deserialize",
|
|
|
|
serialize_with = "::hyper_serde::serialize")]
|
|
|
|
Cookie,
|
2017-06-23 16:12:58 +00:00
|
|
|
CookieSource,
|
2017-06-12 04:01:41 +00:00
|
|
|
),
|
2017-06-05 14:21:39 +00:00
|
|
|
}
|
2017-07-25 09:51:29 +00:00
|
|
|
|
|
|
|
enum Loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong
|
|
|
|
{}
|
|
|
|
enum Looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong
|
|
|
|
{}
|
|
|
|
enum Loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong
|
|
|
|
{}
|
|
|
|
enum Loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong
|
|
|
|
{
|
|
|
|
Foo,
|
|
|
|
}
|
2017-08-11 08:54:20 +00:00
|
|
|
|
|
|
|
// #1046
|
|
|
|
pub enum Entry<'a, K: 'a, V: 'a> {
|
2017-09-19 02:41:50 +00:00
|
|
|
Vacant(#[stable(feature = "rust1", since = "1.0.0")] VacantEntry<'a, K, V>),
|
|
|
|
Occupied(#[stable(feature = "rust1", since = "1.0.0")] OccupiedEntry<'a, K, V>),
|
2017-08-11 08:54:20 +00:00
|
|
|
}
|
2017-10-24 16:08:32 +00:00
|
|
|
|
|
|
|
// #2081
|
|
|
|
pub enum ForegroundColor {
|
|
|
|
CYAN =
|
|
|
|
(winapi::FOREGROUND_INTENSITY | winapi::FOREGROUND_GREEN | winapi::FOREGROUND_BLUE) as u16,
|
|
|
|
}
|
2017-10-30 12:35:23 +00:00
|
|
|
|
|
|
|
// #2098
|
|
|
|
pub enum E<'a> {
|
|
|
|
V(<std::slice::Iter<'a, Xxxxxxxxxxxxxx> as Iterator>::Item),
|
|
|
|
}
|
2017-11-16 07:01:50 +00:00
|
|
|
|
|
|
|
// #1809
|
|
|
|
enum State {
|
|
|
|
TryRecv {
|
|
|
|
pos: usize,
|
|
|
|
lap: u8,
|
|
|
|
closed_count: usize,
|
|
|
|
},
|
|
|
|
Subscribe {
|
|
|
|
pos: usize,
|
|
|
|
},
|
|
|
|
IsReady {
|
|
|
|
pos: usize,
|
|
|
|
ready: bool,
|
|
|
|
},
|
|
|
|
Unsubscribe {
|
|
|
|
pos: usize,
|
|
|
|
lap: u8,
|
|
|
|
id_woken: usize,
|
|
|
|
},
|
|
|
|
FinalTryRecv {
|
|
|
|
pos: usize,
|
|
|
|
id_woken: usize,
|
|
|
|
},
|
|
|
|
TimedOut,
|
|
|
|
Disconnected,
|
|
|
|
}
|