From 1b876449346c539c0d0cd98ef2d89c3049430c89 Mon Sep 17 00:00:00 2001 From: darkicewolf50 <95242911+darkicewolf50@users.noreply.github.com> Date: Thu, 30 Jan 2025 18:10:46 +0000 Subject: [PATCH] started ch10.2 --- Traits.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Traits.md diff --git a/Traits.md b/Traits.md new file mode 100644 index 0000000..0278085 --- /dev/null +++ b/Traits.md @@ -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