From 3efbb1ddc8b85f85621db9b37a0980ec88d2386d Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Fri, 11 Jan 2019 00:41:59 +0000 Subject: Return Box in default_backend() This patch refactors the default_backend function to return a Box instead of impl Backend. This will allow us to dynamically choose the backend implementation in a future patch. To keep the current interface, we change show_with to accept both a reference to a backend instance as well as a reference to a boxed backend instance. This also means we have to implement AsRef for the backend structs. --- src/backends/dialog.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/backends/dialog.rs') diff --git a/src/backends/dialog.rs b/src/backends/dialog.rs index 939b8f3..6f078e6 100644 --- a/src/backends/dialog.rs +++ b/src/backends/dialog.rs @@ -77,6 +77,12 @@ impl Dialog { } } +impl AsRef for Dialog { + fn as_ref(&self) -> &Self { + self + } +} + fn require_success(status: process::ExitStatus) -> Result<()> { if status.success() { Ok(()) -- cgit v1.2.1