Sign in
android
/
toolchain
/
rustc
/
15a6560abe9880705f51d219c1fa94f880dbaf35
/
.
/
src
/
doc
/
book
/
listings
/
ch05-using-structs-to-structure-related-data
/
no-listing-03-associated-functions
/
src
/
main.rs
blob: d5b1692a4fe80e368ed56dcd860fa4479b3d282c [
file
] [
log
] [
blame
]
#[
derive
(
Debug
)]
struct
Rectangle
{
width
:
u32
,
height
:
u32
,
}
// ANCHOR: here
impl
Rectangle
{
fn
square
(
size
:
u32
)
->
Rectangle
{
Rectangle
{
width
:
size
,
height
:
size
,
}
}
}
// ANCHOR_END: here
fn
main
()
{
let
sq
=
Rectangle
::
square
(
3
);
}