File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11[package ]
22name = " rdif-serial"
3- version = " 0.5.2 "
3+ version = " 0.5.3 "
44edition.workspace = true
55repository.workspace = true
66authors = [" 周睿 <zrufo747@outlook.com>" ]
Original file line number Diff line number Diff line change @@ -15,6 +15,16 @@ pub type BSender = Box<dyn TSender>;
1515pub type BReciever = Box < dyn TReciever > ;
1616pub type BSerial = Box < dyn Interface > ;
1717
18+ impl DriverGeneric for Box < dyn Interface > {
19+ fn open ( & mut self ) -> Result < ( ) , KError > {
20+ self . as_mut ( ) . open ( )
21+ }
22+
23+ fn close ( & mut self ) -> Result < ( ) , KError > {
24+ self . as_mut ( ) . close ( )
25+ }
26+ }
27+
1828mod serial;
1929
2030pub use serial:: * ;
Original file line number Diff line number Diff line change @@ -29,6 +29,10 @@ impl<T: Register> Serial<T> {
2929 }
3030 }
3131
32+ pub fn new_boxed ( inner : T ) -> Box < dyn crate :: Interface > {
33+ Box :: new ( Self :: new ( inner) ) as _
34+ }
35+
3236 fn inner_mut ( & mut self ) -> & mut T {
3337 unsafe { & mut * self . inner . 0 . get ( ) }
3438 }
You can’t perform that action at this time.
0 commit comments