add mut to transport layer

This commit is contained in:
Simon Wicky
2026-05-15 12:47:07 +02:00
parent 6fb4a98667
commit c02c28f7cb
7 changed files with 16 additions and 12 deletions
+1 -1
View File
@@ -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)
+6 -2
View File
@@ -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(),
+2 -2
View File
@@ -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(
+2 -2
View File
@@ -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>> {
+2 -2
View File
@@ -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>> {
+2 -2
View File
@@ -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>> {