mirror of
https://github.com/m-lamonaca/dev-notes.git
synced 2025-04-08 11:56:41 +00:00
rust: add associated consts notes
This commit is contained in:
parent
d388e53499
commit
58656c56c4
1 changed files with 10 additions and 0 deletions
|
@ -665,6 +665,16 @@ s.associated_function(arg); // use struct method
|
||||||
Struct::type_associated_function(arg);
|
Struct::type_associated_function(arg);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Associated Consts
|
||||||
|
|
||||||
|
```rs
|
||||||
|
struct Struct {
|
||||||
|
const ASSOCIATED_CONST: Type = <value>;
|
||||||
|
}
|
||||||
|
|
||||||
|
Struct::ASSOCIATED_CONST;
|
||||||
|
```
|
||||||
|
|
||||||
## Traits
|
## Traits
|
||||||
|
|
||||||
A Trait is a collection of methods representing a set of behaviours necessary to accomplish some task.
|
A Trait is a collection of methods representing a set of behaviours necessary to accomplish some task.
|
||||||
|
|
Loading…
Add table
Reference in a new issue