Skip to content

How to use generic traits? [Question] #235

Answered by 9prady9
BA8F0D39 asked this question in Q&A
Discussion options

You must be logged in to vote

In that case, you should look at https://doc.rust-lang.org/rust-by-example/generics.html

fn foo<T>(arg: T) { ... } that is how you define a generic function. In this case, the generic type T is what reused for defining the generic type Array<> that is in turn used a arguments to the function.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by 9prady9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #235 on December 09, 2020 05:16.