Sign in
android
/
toolchain
/
rustc
/
15a6560abe9880705f51d219c1fa94f880dbaf35
/
.
/
src
/
doc
/
book
/
listings
/
ch17-oop
/
listing-17-06
/
src
/
lib.rs
blob: 63a8907d3673dd89f1b2d8f5fb5c805909af08e9 [
file
] [
log
] [
blame
]
pub
trait
Draw
{
fn
draw
(&
self
);
}
// ANCHOR: here
pub
struct
Screen
<
T
:
Draw
>
{
pub
components
:
Vec
<
T
>,
}
impl
<
T
>
Screen
<
T
>
where
T
:
Draw
,
{
pub
fn
run
(&
self
)
{
for
component in
self
.
components
.
iter
()
{
component
.
draw
();
}
}
}
// ANCHOR_END: here