diff options
Diffstat (limited to 'src/main/scala/firrtl/options/OptionsView.scala')
| -rw-r--r-- | src/main/scala/firrtl/options/OptionsView.scala | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/scala/firrtl/options/OptionsView.scala b/src/main/scala/firrtl/options/OptionsView.scala index 49417ded..4235b660 100644 --- a/src/main/scala/firrtl/options/OptionsView.scala +++ b/src/main/scala/firrtl/options/OptionsView.scala @@ -19,11 +19,16 @@ trait OptionsView[T] { /** A shim to manage multiple "views" of an [[firrtl.AnnotationSeq AnnotationSeq]] */ object Viewer { + /** Helper method to get at a given [[OptionsView]]. This enables access to [[OptionsView]] methods in a more canonical + * format, e.g., you can then do `Viewer[T].view`. + * @param a an implicit [[OptionsView]] + */ + def apply[T](implicit a: OptionsView[T]): OptionsView[T] = a + /** Convert annotations to options using an implicitly provided [[OptionsView]] * @param options some annotations - * @param optionsView a converter of options to the requested type * @tparam T the type to which the input [[firrtl.AnnotationSeq AnnotationSeq]] should be viewed as */ - def view[T](options: AnnotationSeq)(implicit optionsView: OptionsView[T]): T = optionsView.view(options) + def view[T: OptionsView](options: AnnotationSeq): T = Viewer[T].view(options) } |
