]> git.lizzy.rs Git - rust.git/blob - src/librustdoc/demo.rs
switch Drop to `&mut self`
[rust.git] / src / librustdoc / demo.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.
4 //
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.
10
11 // no-reformat
12
13 /*!
14  * A demonstration module
15  *
16  * Contains documentation in various forms that rustdoc understands,
17  * for testing purposes. It doesn't surve any functional
18  * purpose. This here, for instance, is just some filler text.
19  *
20  * FIXME (#3731): It would be nice if we could run some automated
21  * tests on this file
22  */
23
24
25 /// The base price of a muffin on a non-holiday
26 static PRICE_OF_A_MUFFIN: float = 70f;
27
28 struct WaitPerson {
29     hair_color: ~str
30 }
31
32 /// The type of things that produce omnomnom
33 enum OmNomNomy {
34     /// Delicious sugar cookies
35     Cookie,
36     /// It's pizza
37     PizzaPie(~[uint])
38 }
39
40 fn take_my_order_please(
41     _waitperson: WaitPerson,
42     _order: ~[OmNomNomy]
43 ) -> uint {
44
45     /*!
46      * OMG would you take my order already?
47      *
48      * # Arguments
49      *
50      * * _waitperson - The waitperson that you want to bother
51      * * _order - The order vector. It should be filled with food
52      *
53      * # Return
54      *
55      * The price of the order, including tax
56      *
57      * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nec
58      * molestie nisl. Duis massa risus, pharetra a scelerisque a,
59      * molestie eu velit. Donec mattis ligula at ante imperdiet ut
60      * dapibus mauris malesuada.
61      *
62      * Sed gravida nisi a metus elementum sit amet hendrerit dolor
63      * bibendum. Aenean sit amet neque massa, sed tempus tortor. Sed ut
64      * lobortis enim. Proin a mauris quis nunc fermentum ultrices eget a
65      * erat. Mauris in lectus vitae metus sodales auctor. Morbi nunc
66      * quam, ultricies at venenatis non, pellentesque ac dui.
67      *
68      * # Failure
69      *
70      * This function is full of fail
71      */
72
73     fail!();
74 }
75
76 mod fortress_of_solitude {
77     /*!
78      * Superman's vacation home
79      *
80      * The fortress of solitude is located in the Arctic and it is
81      * cold. What you may not know about the fortress of solitude
82      * though is that it contains two separate bowling alleys. One of
83      * them features bumper-bowling and is kind of lame.
84      *
85      * Really, it's pretty cool.
86      */
87
88 }
89
90 mod blade_runner {
91     /*!
92      * Blade Runner is probably the best movie ever
93      *
94      * I like that in the world of Blade Runner it is always
95      * raining, and that it's always night time. And Aliens
96      * was also a really good movie.
97      *
98      * Alien 3 was crap though.
99      */
100 }
101
102 /**
103  * Bored
104  *
105  * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nec
106  * molestie nisl. Duis massa risus, pharetra a scelerisque a,
107  * molestie eu velit. Donec mattis ligula at ante imperdiet ut
108  * dapibus mauris malesuada. Sed gravida nisi a metus elementum sit
109  * amet hendrerit dolor bibendum. Aenean sit amet neque massa, sed
110  * tempus tortor. Sed ut lobortis enim. Proin a mauris quis nunc
111  * fermentum ultrices eget a erat. Mauris in lectus vitae metus
112  * sodales auctor. Morbi nunc quam, ultricies at venenatis non,
113  * pellentesque ac dui.
114  *
115  * Quisque vitae est id eros placerat laoreet sit amet eu
116  * nisi. Curabitur suscipit neque porttitor est euismod
117  * lacinia. Curabitur non quam vitae ipsum adipiscing
118  * condimentum. Mauris ut ante eget metus sollicitudin
119  * blandit. Aliquam erat volutpat. Morbi sed nisl mauris. Nulla
120  * facilisi. Phasellus at mollis ipsum. Maecenas sed convallis
121  * sapien. Nullam in ligula turpis. Pellentesque a neque augue. Sed
122  * eget ante feugiat tortor congue auctor ac quis ante. Proin
123  * condimentum lacinia tincidunt.
124  */
125 struct Bored {
126   bored: bool,
127 }
128
129 impl Drop for Bored {
130   fn drop(&mut self) { }
131 }
132
133 /**
134  * The Shunned House
135  *
136  * From even the greatest of horrors irony is seldom absent. Sometimes it
137  * enters directly into the composition of the events, while sometimes it
138  * relates only to their fortuitous position among persons and
139  * places. The latter sort is splendidly exemplified by a case in the
140  * ancient city of Providence, where in the late forties Edgar Allan Poe
141  * used to sojourn often during his unsuccessful wooing of the gifted
142  * poetess, Mrs.  Whitman. Poe generally stopped at the Mansion House in
143  * Benefit Street--the renamed Golden Ball Inn whose roof has sheltered
144  * Washington, Jefferson, and Lafayette--and his favorite walk led
145  * northward along the same street to Mrs. Whitman's home and the
146  * neighboring hillside churchyard of St. John's, whose hidden expanse of
147  * Eighteenth Century gravestones had for him a peculiar fascination.
148  */
149 trait TheShunnedHouse {
150     /**
151      * Now the irony is this. In this walk, so many times repeated, the
152      * world's greatest master of the terrible and the bizarre was
153      * obliged to pass a particular house on the eastern side of the
154      * street; a dingy, antiquated structure perched on the abruptly
155      * rising side hill, with a great unkempt yard dating from a time
156      * when the region was partly open country. It does not appear that
157      * he ever wrote or spoke of it, nor is there any evidence that he
158      * even noticed it. And yet that house, to the two persons in
159      * possession of certain information, equals or outranks in horror
160      * the wildest fantasy of the genius who so often passed it
161      * unknowingly, and stands starkly leering as a symbol of all that is
162      * unutterably hideous.
163      *
164      * # Arguments
165      *
166      * * unkempt_yard - A yard dating from a time when the region was partly
167      *                  open country
168      */
169     fn dingy_house(&self, unkempt_yard: int);
170
171     /**
172      * The house was--and for that matter still is--of a kind to attract
173      * the attention of the curious. Originally a farm or semi-farm
174      * building, it followed the average New England colonial lines of
175      * the middle Eighteenth Century--the prosperous peaked-roof sort,
176      * with two stories and dormerless attic, and with the Georgian
177      * doorway and interior panelling dictated by the progress of taste
178      * at that time. It faced south, with one gable end buried to the
179      * lower windows in the eastward rising hill, and the other exposed
180      * to the foundations toward the street. Its construction, over a
181      * century and a half ago, had followed the grading and straightening
182      * of the road in that especial vicinity; for Benefit Street--at
183      * first called Back Street--was laid out as a lane winding amongst
184      * the graveyards of the first settlers, and straightened only when
185      * the removal of the bodies to the North Burial Ground made it
186      * decently possible to cut through the old family plots.
187      */
188     fn construct(&self) -> bool;
189 }
190
191 /// Whatever
192 impl TheShunnedHouse for OmNomNomy {
193     fn dingy_house(&self, _unkempt_yard: int) {
194     }
195
196     fn construct(&self) -> bool {
197         fail!();
198     }
199 }