-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add From extension AST to definition AST
Summary: I have a problem where I've got some generic functions to operate over SDL definitions. I define a trait, and implement that trait once per definition type. By default, I need to *explicitly* define this trait for each type extension, too. But instead, I can have a helper function that takes in <Def: MyTrait + From<Ext>, Ext> and internally uses `Def::from(ext).my_trait_fn()` By implementing the From trait, I can have a wrapper method that first converts my extensions to regular definitions, then operate on that. Which greatly reduces the likelihood that I make a copy-paste error. Reviewed By: ginfung Differential Revision: D48239949 fbshipit-source-id: 8f401bfb335ca3c2afe0a08c3bd6b69da8a927b6
- Loading branch information
1 parent
e0fb6f8
commit d4ca7d9
Showing
1 changed file
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters