1 // Copyright 2020 The Chromium OS Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 use std::io; 6 7 use crate::ProtectionType; 8 use base::{Event, RawDescriptor}; 9 10 /// Abstraction over serial-like devices that can be created given an event and optional input and 11 /// output streams. 12 pub trait SerialDevice { new( protected_vm: ProtectionType, interrupt_evt: Event, input: Option<Box<dyn io::Read + Send>>, output: Option<Box<dyn io::Write + Send>>, keep_rds: Vec<RawDescriptor>, ) -> Self13 fn new( 14 protected_vm: ProtectionType, 15 interrupt_evt: Event, 16 input: Option<Box<dyn io::Read + Send>>, 17 output: Option<Box<dyn io::Write + Send>>, 18 keep_rds: Vec<RawDescriptor>, 19 ) -> Self; 20 } 21