Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change mock!'s syntax for traits #205

Merged
merged 3 commits into from
Sep 7, 2020
Merged

Change mock!'s syntax for traits #205

merged 3 commits into from
Sep 7, 2020

Commits on Sep 7, 2020

  1. Internally, MockableStruct now uses ItemImpls instead of ItemTraits

    This may allow some simplification to the code.  And it's neccessary
    in order to someday allow concrete structs that implement generic traits.
    asomers committed Sep 7, 2020
    Configuration menu
    Copy the full SHA
    3885d45 View commit details
    Browse the repository at this point in the history
  2. Internally, MockTrait can now represent fully qualified traits

    But mock! still won't allow them.
    asomers committed Sep 7, 2020
    Configuration menu
    Copy the full SHA
    a92588d View commit details
    Browse the repository at this point in the history
  3. Change mock!'s syntax for traits

    Previously the syntax looked like a trait definition (trait X).  But
    that's ambiguous in the case of generic traits.  It doesn't make clear
    the relationship between the trait's generic parameters and the struct's
    generic parameters.  And it made it impossible for a concrete struct to
    implement a generic trait.
    
    The new syntax looks like a trait impl (impl X for Y).  That solves all
    the problems with generics.  In addition, it allows mock! to implement
    traits that aren't imported directly into the current namespace
    (impl x::y::Z for Foo).
    
    The old syntax is deprecated, but will be supported for at least one
    more release.
    
    Fixes #119
    asomers committed Sep 7, 2020
    Configuration menu
    Copy the full SHA
    5fe0235 View commit details
    Browse the repository at this point in the history