backend: set default type for VhostUserBackend
Use () as default type for trait VhostUserBackend and VhostUserBackendMut. Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
This commit is contained in:
parent
6b685925a1
commit
6d04368c46
3 changed files with 6 additions and 6 deletions
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"coverage_score": 50.8,
|
||||
"coverage_score": 77.4,
|
||||
"exclude_path": "",
|
||||
"crate_features": ""
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<T>" and "RefCell<T>".
|
||||
pub trait VhostUserBackend<B: Bitmap + 'static>: Send + Sync + 'static {
|
||||
pub trait VhostUserBackend<B: Bitmap + 'static = ()>: Send + Sync + 'static {
|
||||
/// Get number of queues supported.
|
||||
fn num_queues(&self) -> usize;
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ pub trait VhostUserBackend<B: Bitmap + 'static>: Send + Sync + 'static {
|
|||
}
|
||||
|
||||
/// Trait without interior mutability for vhost user backend servers to implement concrete services.
|
||||
pub trait VhostUserBackendMut<B: Bitmap + 'static>: Send + Sync + 'static {
|
||||
pub trait VhostUserBackendMut<B: Bitmap + 'static = ()>: 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);
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ pub type Result<T> = result::Result<T, Error>;
|
|||
///
|
||||
/// 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<S: VhostUserBackend<B>, B: Bitmap + 'static> {
|
||||
pub struct VhostUserDaemon<S: VhostUserBackend<B>, B: Bitmap + 'static = ()> {
|
||||
name: String,
|
||||
handler: Arc<Mutex<VhostUserHandler<S, B>>>,
|
||||
main_thread: Option<thread::JoinHandle<Result<()>>>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue