None
FR
Rust: Traits
[]
Emil Privér
To create a trait, you write trait X where X is the name of your trait. These traits are useful for creating traits that can work with more than one type. pub trait DatabaseDriver { async fn execute ( self , query : & str ) -> Result < ( ) > ; async fn get_or_create_schema_migrations ( self ) -> Result < Vec < String >> ; } fn print_serialized_trait_object < T : Serialize > ( t : & T ) { let serialized = serde_json :: to_string ( t ) .