Skip to content

Commit 000d12f

Browse files
committed
Use "trait" rather than "iface" where possible in docs
1 parent 2370474 commit 000d12f

File tree

1 file changed

+28
-29
lines changed

1 file changed

+28
-29
lines changed

doc/rust.md

+28-29
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ of [attributes](#attributes) attached to it.
574574

575575
~~~~~~~~ {.ebnf .gram}
576576
item : mod_item | fn_item | type_item | enum_item
577-
| res_item | iface_item | impl_item | foreign_mod_item ;
577+
| res_item | trait_item | impl_item | foreign_mod_item ;
578578
~~~~~~~~
579579

580580
An _item_ is a component of a crate; some module items can be defined in crate
@@ -1259,7 +1259,7 @@ those methods for a specific type.
12591259
# type surface = int;
12601260
# type bounding_box = int;
12611261
1262-
iface shape {
1262+
trait shape {
12631263
fn draw(surface);
12641264
fn bounding_box() -> bounding_box;
12651265
}
@@ -1275,7 +1275,7 @@ These appear after the name, using the same syntax used in [generic
12751275
functions](#generic-functions).
12761276

12771277
~~~~
1278-
iface seq<T> {
1278+
trait seq<T> {
12791279
fn len() -> uint;
12801280
fn elt_at(n: uint) -> T;
12811281
fn iter(fn(T));
@@ -1290,7 +1290,7 @@ that have the parameter's type. For example:
12901290

12911291
~~~~
12921292
# type surface = int;
1293-
# iface shape { fn draw(surface); }
1293+
# trait shape { fn draw(surface); }
12941294
12951295
fn draw_twice<T: shape>(surface: surface, sh: T) {
12961296
sh.draw(surface);
@@ -1301,33 +1301,33 @@ fn draw_twice<T: shape>(surface: surface, sh: T) {
13011301
Trait items also define a type with the same name as the
13021302
trait. Values of this type are created by
13031303
[casting](#type-cast-expressions) values (of a type for which an
1304-
implementation of the given interface is in scope) to the interface
1304+
implementation of the given trait is in scope) to the trait
13051305
type.
13061306

13071307
~~~~
1308-
# iface shape { }
1308+
# trait shape { }
13091309
# impl of shape for int { }
13101310
# let mycircle = 0;
13111311
13121312
let myshape: shape = mycircle as shape;
13131313
~~~~
13141314

1315-
The resulting value is a reference counted box containing the value
1315+
The resulting value is a reference-counted box containing the value
13161316
that was cast along with information that identify the methods of the
1317-
implementation that was used. Values with an interface type can always
1318-
have methods of their interface called on them, and can be used to
1319-
instantiate type parameters that are bounded on their interface.
1317+
implementation that was used. Values with a trait type can always
1318+
have methods from their trait called on them, and can be used to
1319+
instantiate type parameters that are bounded by their trait.
13201320

13211321
### Implementations
13221322

1323-
An _implementation item_ provides an implementation of an
1324-
[interface](#traits) for a type.
1323+
An _implementation item_ provides an implementation of a
1324+
[trait](#traits) for a type.
13251325

13261326
~~~~
13271327
# type point = {x: float, y: float};
13281328
# type surface = int;
13291329
# type bounding_box = {x: float, y: float, width: float, height: float};
1330-
# iface shape { fn draw(surface); fn bounding_box() -> bounding_box; }
1330+
# trait shape { fn draw(surface); fn bounding_box() -> bounding_box; }
13311331
# fn do_draw_circle(s: surface, c: circle) { }
13321332
13331333
type circle = {radius: float, center: point};
@@ -1342,16 +1342,16 @@ impl circle_shape of shape for circle {
13421342
}
13431343
~~~~
13441344

1345-
This defines an implementation named `circle_shape` of interface
1345+
This defines an implementation named `circle_shape` of trait
13461346
`shape` for type `circle`. The name of the implementation is the name
13471347
by which it is imported and exported, but has no further significance.
1348-
It may be omitted to default to the name of the interface that was
1348+
It may be omitted to default to the name of the trait that was
13491349
implemented. Implementation names do not conflict the way other names
13501350
do: multiple implementations with the same name may exist in a scope at
13511351
the same time.
13521352

1353-
It is possible to define an implementation without referencing an
1354-
interface. The methods in such an implementation can only be used
1353+
It is possible to define an implementation without referring to a trait.
1354+
The methods in such an implementation can only be used
13551355
statically (as direct calls on the values of the type that the
13561356
implementation targets). In such an implementation, the `of` clause is
13571357
not given, and the name is mandatory.
@@ -1365,17 +1365,17 @@ impl uint_loops for uint {
13651365
}
13661366
~~~~
13671367

1368-
_When_ an interface is specified, all methods declared as part of the
1369-
interface must be present, with matching types and type parameter
1368+
_When_ a trait is specified, all methods declared as part of the
1369+
trait must be present, with matching types and type parameter
13701370
counts, in the implementation.
13711371

13721372
An implementation can take type parameters, which can be different
1373-
from the type parameters taken by the interface it implements. They
1373+
from the type parameters taken by the trait it implements. They
13741374
are written after the name of the implementation, or if that is not
13751375
specified, after the `impl` keyword.
13761376

13771377
~~~~
1378-
# iface seq<T> { }
1378+
# trait seq<T> { }
13791379
13801380
impl <T> of seq<T> for ~[T] {
13811381
/* ... */
@@ -1540,7 +1540,7 @@ statement block. The declared name may denote a new slot or a new item.
15401540

15411541
An _item declaration statement_ has a syntactic form identical to an
15421542
[item](#items) declaration within a module. Declaring an item -- a function,
1543-
enumeration, type, resource, interface, implementation or module -- locally
1543+
enumeration, type, resource, trait, implementation or module -- locally
15441544
within a statement block is simply a way of restricting its scope to a narrow
15451545
region containing all of its uses; it is otherwise identical in meaning to
15461546
declaring the item outside the statement block.
@@ -2763,8 +2763,7 @@ Every trait item (see [traits](#traits)) defines a type with the same name
27632763
as the trait. For a trait `T`, cast expressions introduce values of type `T`:
27642764

27652765
~~~~~~~~
2766-
// doc extractor doesn't recognize trait -- fix it
2767-
iface printable {
2766+
trait printable {
27682767
fn to_str() -> ~str;
27692768
}
27702769
@@ -2811,7 +2810,7 @@ impl item. It refers to the type of the implicit `self` argument. For
28112810
example, in:
28122811

28132812
~~~~~~
2814-
iface printable {
2813+
trait printable {
28152814
fn to_str() -> ~str;
28162815
}
28172816
@@ -2848,7 +2847,7 @@ Sendable
28482847
Copyable
28492848
: This kind includes all types that can be copied. All types with
28502849
sendable kind are copyable, as are shared boxes, shared closures,
2851-
interface types, and structural types built out of these.
2850+
trait types, and structural types built out of these.
28522851
Noncopyable
28532852
: [Resource](#resources) types, and every type that includes a
28542853
resource without storing it in a shared box, may not be copied.
@@ -2933,10 +2932,10 @@ shared or unique boxes, and/or references. Sharing memory between tasks can
29332932
only be accomplished using *unsafe* constructs, such as raw pointer
29342933
operations or calling C code.
29352934

2936-
When a task sends a value satisfying the `send` interface over a channel, it
2935+
When a task sends a value that has the `send` trait over a channel, it
29372936
loses ownership of the value sent and can no longer refer to it. This is
29382937
statically guaranteed by the combined use of "move semantics" and the
2939-
compiler-checked _meaning_ of the `send` interface: it is only instantiated
2938+
compiler-checked _meaning_ of the `send` trait: it is only instantiated
29402939
for (transitively) unique kinds of data constructor and pointers, never shared
29412940
pointers.
29422941

@@ -3117,7 +3116,7 @@ channels -- may lead to the same port.]
31173116
Each port and channel can carry only one type of message. The message type is
31183117
encoded as a parameter of the channel or port type. The message type of a
31193118
channel is equal to the message type of the port it is bound to. The types of
3120-
messages must satisfy the `send` built-in interface.
3119+
messages must satisfy the `send` built-in trait.
31213120

31223121
Messages are generally sent asynchronously, with optional
31233122
rate-limiting on the transmit side. Each port contains a message

0 commit comments

Comments
 (0)