更新listings/ch05-using-structs-to-structure-related-data/no-listing-03-associated-functions/src/main.rs

This commit is contained in:
Xuzheng77s 2022-08-19 19:01:53 +08:00
parent dd8c1bb414
commit 7cea50d3cd
7 changed files with 10 additions and 2 deletions

View File

@ -6,8 +6,8 @@ struct Rectangle {
// ANCHOR: here
impl Rectangle {
fn square(size: u32) -> Rectangle {
Rectangle {
fn square(size: u32) -> Self {
Self {
width: size,
height: size,
}

View File

@ -0,0 +1,3 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cargo.
# For information about cache directory tags see https://bford.info/cachedir/

View File

@ -0,0 +1,3 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cargo.
# For information about cache directory tags see https://bford.info/cachedir/