8000 GitHub - ihuguet/rust-poly
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ihuguet/rust-poly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Different options to implement something similar to polymorphism in an ergonomic way.

Rust offer 2 main options:

  • dyn Trait: difficult to get the concrete type if needed
  • enums: becomes too verbose as you need to match all the enum variants all the time

In this repo, options 1 and 2 uses dyn Trait, showing different options to recover the concrete type from the dyn Trait object. Option 3 uses the crate enum_dispatch to allow using enums in a less verbose way.

Test with cargo run --bin optionN

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0