From 6d04368c4641a4ffa94822f78bbdd9b5b04bb478 Mon Sep 17 00:00:00 2001 From: Liu Jiang Date: Fri, 13 Aug 2021 14:25:37 +0800 Subject: [PATCH] backend: set default type for VhostUserBackend Use () as default type for trait VhostUserBackend and VhostUserBackendMut. Signed-off-by: Liu Jiang --- coverage_config_x86_64.json | 2 +- src/backend.rs | 8 ++++---- src/lib.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/coverage_config_x86_64.json b/coverage_config_x86_64.json index ffb5a5d..0036d98 100644 --- a/coverage_config_x86_64.json +++ b/coverage_config_x86_64.json @@ -1,5 +1,5 @@ { - "coverage_score": 50.8, + "coverage_score": 77.4, "exclude_path": "", "crate_features": "" } diff --git a/src/backend.rs b/src/backend.rs index ba8d725..d15629e 100644 --- a/src/backend.rs +++ b/src/backend.rs @@ -34,7 +34,7 @@ use super::{Vring, GM}; /// /// To support multi-threading and asynchronous IO, we enforce `the Send + Sync + 'static`. /// So there's no plan for support of "Rc" and "RefCell". -pub trait VhostUserBackend: Send + Sync + 'static { +pub trait VhostUserBackend: Send + Sync + 'static { /// Get number of queues supported. fn num_queues(&self) -> usize; @@ -113,7 +113,7 @@ pub trait VhostUserBackend: Send + Sync + 'static { } /// Trait without interior mutability for vhost user backend servers to implement concrete services. -pub trait VhostUserBackendMut: Send + Sync + 'static { +pub trait VhostUserBackendMut: Send + Sync + 'static { /// Get number of queues supported. fn num_queues(&self) -> usize; @@ -486,7 +486,7 @@ pub mod tests { assert_eq!(backend.queues_per_thread(), [1, 1]); assert_eq!(backend.get_config(0x200, 8), vec![0xa5; 8]); - backend.set_config(0x200, &vec![0xa5; 8]).unwrap(); + backend.set_config(0x200, &[0xa5; 8]).unwrap(); backend.acked_features(0xffff); assert_eq!(backend.lock().unwrap().acked_features, 0xffff); @@ -509,7 +509,7 @@ pub mod tests { assert_eq!(backend.queues_per_thread(), [1, 1]); assert_eq!(backend.get_config(0x200, 8), vec![0xa5; 8]); - backend.set_config(0x200, &vec![0xa5; 8]).unwrap(); + backend.set_config(0x200, &[0xa5; 8]).unwrap(); backend.acked_features(0xffff); assert_eq!(backend.read().unwrap().acked_features, 0xffff); diff --git a/src/lib.rs b/src/lib.rs index ddcc740..1af2241 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -75,7 +75,7 @@ pub type Result = result::Result; /// /// This structure is the public API the backend is allowed to interact with in order to run /// a fully functional vhost-user daemon. -pub struct VhostUserDaemon, B: Bitmap + 'static> { +pub struct VhostUserDaemon, B: Bitmap + 'static = ()> { name: String, handler: Arc>>, main_thread: Option>>,