mirror of
https://github.com/darkicewolf50/RustBrock.git
synced 2025-06-15 13:04:18 -06:00
started ch10.2
This commit is contained in:
parent
b1bef1f2f6
commit
1b87644934
13
Traits.md
Normal file
13
Traits.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Traits
|
||||
|
||||
This is used to defined shared behavior
|
||||
|
||||
A *trait* defines the fnctionality a particular type has and can share with other tpyes.
|
||||
|
||||
Traits are ued to define shared behavior in an abstract way.
|
||||
|
||||
We can use *trait bounds* to specifty that a generic type can be any type that has certain behavior
|
||||
|
||||
Note: Traits are similar to a feature often called *interfaces* in other languages, but there are some differences in Rust
|
||||
|
||||
## Defining a Trait
|
Loading…
x
Reference in New Issue
Block a user