Pastebin
API
tools
faq
paste
Login
Sign up
SHARE
TWEET
[Rust] Using generics in functions
cwchen
Sep 8th, 2017
1,077
0
Never
Add comment
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!
Rust
0.16 KB
| None
|
0
0
raw
download
clone
embed
print
report
// For a trait of general number
extern
crate num
;
fn
add
<
T
>
(
a
:
T
,
b
:
T
)
->
T where T
:
num
::
Num
{
a
+
b
}
fn
main
(
)
{
assert_eq
!
(
5
,
add
(
3
,
2
)
)
;
}
Advertisement
Add Comment
Please,
Sign In
to add comment
Public Pastes
⭐ Instant Profit Method ⭐
JavaScript | 6 sec ago | 0.32 KB
ChangeNOW Bug (Get more on BTC swaps)
JavaScript | 13 sec ago | 0.32 KB
Exchange Exploit T P
JavaScript | 16 sec ago | 0.32 KB
⭐ Free ETH Method ⭐
JavaScript | 21 sec ago | 0.32 KB
Swapzone Glitch (Working)E J
JavaScript | 35 sec ago | 0.32 KB
Free Crypto Method (NEVER SEEN BEFORE)
JavaScript | 35 sec ago | 0.32 KB
✅ Exploit 500$ in 15 Minutes
JavaScript | 43 sec ago | 0.32 KB
✅ MAKE $9OO INSTANTLY D 5
JavaScript | 49 sec ago | 0.32 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!