net-ppp: take serial port and config in run(), allow calling it multiple times.

This commit is contained in:
Dario Nieuwenhuis
2023-08-25 15:57:02 +02:00
parent 2303382dfd
commit c2d601abef
2 changed files with 39 additions and 23 deletions

View File

@ -74,6 +74,18 @@ impl<'d, const MTU: usize> Runner<'d, MTU> {
)
}
pub fn borrow_split(&mut self) -> (StateRunner<'_>, RxRunner<'_, MTU>, TxRunner<'_, MTU>) {
(
StateRunner { shared: self.shared },
RxRunner {
rx_chan: self.rx_chan.borrow(),
},
TxRunner {
tx_chan: self.tx_chan.borrow(),
},
)
}
pub fn state_runner(&self) -> StateRunner<'d> {
StateRunner { shared: self.shared }
}