add mut to transport layer
This commit is contained in:
@@ -124,7 +124,7 @@ where
|
||||
const OVERHEAD_SIZE: usize = T::OVERHEAD_SIZE;
|
||||
|
||||
fn to_transport_packet(
|
||||
&self,
|
||||
&mut self,
|
||||
frame: AddressedTimedData<Ts, T::Frame, NdId>,
|
||||
) -> AddressedTimedData<Ts, Pkt, NdId> {
|
||||
self.transport.to_transport_packet(frame)
|
||||
|
||||
@@ -40,7 +40,7 @@ where
|
||||
type Frame = Vec<u8>;
|
||||
const OVERHEAD_SIZE: usize = 0;
|
||||
fn to_transport_packet(
|
||||
&self,
|
||||
&mut self,
|
||||
frame: AddressedTimedPayload<Ts, NdId>,
|
||||
) -> AddressedTimedData<Ts, Pkt, NdId> {
|
||||
frame.data_transform(|data| data.into())
|
||||
@@ -83,7 +83,11 @@ where
|
||||
{
|
||||
type Frame = Vec<u8>;
|
||||
type Error = std::convert::Infallible;
|
||||
fn packet_to_frame(&self, packet: Pkt, timestamp: Ts) -> Result<TimedPayload<Ts>, Self::Error> {
|
||||
fn packet_to_frame(
|
||||
&mut self,
|
||||
packet: Pkt,
|
||||
timestamp: Ts,
|
||||
) -> Result<TimedPayload<Ts>, Self::Error> {
|
||||
Ok(TimedData {
|
||||
timestamp,
|
||||
data: packet.into(),
|
||||
|
||||
@@ -66,7 +66,7 @@ pub trait Transport<Ts, Pkt, NdId> {
|
||||
type Frame;
|
||||
const OVERHEAD_SIZE: usize;
|
||||
fn to_transport_packet(
|
||||
&self,
|
||||
&mut self,
|
||||
frame: AddressedTimedData<Ts, Self::Frame, NdId>,
|
||||
) -> AddressedTimedData<Ts, Pkt, NdId>;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ pub trait TransportUnwrap<Ts, Pkt> {
|
||||
type Frame;
|
||||
type Error;
|
||||
fn packet_to_frame(
|
||||
&self,
|
||||
&mut self,
|
||||
packet: Pkt,
|
||||
timestamp: Ts,
|
||||
) -> Result<TimedData<Ts, Self::Frame>, Self::Error>;
|
||||
|
||||
@@ -210,7 +210,7 @@ impl<Ts> Transport<Ts, LpPacket, u8> for LpTransport {
|
||||
type Frame = LpFrame;
|
||||
const OVERHEAD_SIZE: usize = LpHeader::SIZE;
|
||||
fn to_transport_packet(
|
||||
&self,
|
||||
&mut self,
|
||||
input: AddressedTimedData<Ts, Self::Frame, u8>,
|
||||
) -> AddressedTimedData<Ts, LpPacket, u8> {
|
||||
AddressedTimedData::new_addressed(
|
||||
|
||||
@@ -191,7 +191,7 @@ impl<Ts: Clone> Transport<Ts, SimplePacket, NodeId> for SimpleClientWrappingPipe
|
||||
type Frame = SimpleFrame;
|
||||
const OVERHEAD_SIZE: usize = <SimpleWireWrapper as Transport<Ts, _, _>>::OVERHEAD_SIZE;
|
||||
fn to_transport_packet(
|
||||
&self,
|
||||
&mut self,
|
||||
frame: AddressedTimedData<Ts, SimpleFrame, NodeId>,
|
||||
) -> AddressedTimedData<Ts, SimplePacket, NodeId> {
|
||||
self.0.to_transport_packet(frame)
|
||||
@@ -239,7 +239,7 @@ impl<Ts: Clone> TransportUnwrap<Ts, SimplePacket> for SimpleClientUnwrapping {
|
||||
type Frame = SimpleFrame;
|
||||
type Error = anyhow::Error;
|
||||
fn packet_to_frame(
|
||||
&self,
|
||||
&mut self,
|
||||
packet: SimplePacket,
|
||||
timestamp: Ts,
|
||||
) -> anyhow::Result<TimedData<Ts, SimpleFrame>> {
|
||||
|
||||
@@ -128,7 +128,7 @@ impl<Ts: Clone> Transport<Ts, SimplePacket, NodeId> for SimpleProcessingNode {
|
||||
type Frame = SimpleFrame;
|
||||
const OVERHEAD_SIZE: usize = <SimpleWireWrapper as Transport<Ts, _, _>>::OVERHEAD_SIZE;
|
||||
fn to_transport_packet(
|
||||
&self,
|
||||
&mut self,
|
||||
frame: AddressedTimedData<Ts, SimpleFrame, NodeId>,
|
||||
) -> AddressedTimedData<Ts, SimplePacket, NodeId> {
|
||||
self.wrapper.to_transport_packet(frame)
|
||||
@@ -157,7 +157,7 @@ impl<Ts: Clone> TransportUnwrap<Ts, SimplePacket> for SimpleProcessingNode {
|
||||
type Frame = SimpleFrame;
|
||||
type Error = anyhow::Error;
|
||||
fn packet_to_frame(
|
||||
&self,
|
||||
&mut self,
|
||||
packet: SimplePacket,
|
||||
timestamp: Ts,
|
||||
) -> anyhow::Result<TimedData<Ts, SimpleFrame>> {
|
||||
|
||||
@@ -221,7 +221,7 @@ impl<Ts: Clone> Transport<Ts, SimplePacket, NodeId> for SimpleWireWrapper {
|
||||
type Frame = SimpleFrame;
|
||||
const OVERHEAD_SIZE: usize = 16;
|
||||
fn to_transport_packet(
|
||||
&self,
|
||||
&mut self,
|
||||
frame: AddressedTimedData<Ts, SimpleFrame, NodeId>,
|
||||
) -> AddressedTimedData<Ts, SimplePacket, NodeId> {
|
||||
// SAFETY: If the pipeline is implemented properly, frames perfectly fit in a packet
|
||||
@@ -266,7 +266,7 @@ impl<Ts: Clone> TransportUnwrap<Ts, SimplePacket> for SimpleWireUnwrapper {
|
||||
type Frame = SimpleFrame;
|
||||
type Error = anyhow::Error;
|
||||
fn packet_to_frame(
|
||||
&self,
|
||||
&mut self,
|
||||
packet: SimplePacket,
|
||||
timestamp: Ts,
|
||||
) -> anyhow::Result<TimedData<Ts, SimpleFrame>> {
|
||||
|
||||
Reference in New Issue
Block a user