static method -> associated function
This commit is contained in:
parent
a90dd32949
commit
42240dccb6
1 changed files with 4 additions and 4 deletions
|
|
@ -127,12 +127,12 @@ fn grow(&self) -> Circle {
|
|||
We just say we’re returning a `Circle`. With this method, we can grow a new
|
||||
circle to any arbitrary size.
|
||||
|
||||
# Static methods
|
||||
# Associated functions
|
||||
|
||||
You can also define static methods that do not take a `self` parameter. Here’s a
|
||||
pattern that’s very common in Rust code:
|
||||
You can also define associated functions that do not take a `self` parameter.
|
||||
Here’s a pattern that’s very common in Rust code:
|
||||
|
||||
```
|
||||
```rust
|
||||
struct Circle {
|
||||
x: f64,
|
||||
y: f64,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue