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