distant_net/common/transport/framed/codec/plain.rs
1use std::io;
2
3use super::{Codec, Frame};
4
5/// Represents a codec that does not alter the frame (synonymous with "plain text")
6#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
7pub struct PlainCodec;
8
9impl PlainCodec {
10 pub fn new() -> Self {
11 Self
12 }
13}
14
15impl Codec for PlainCodec {
16 fn encode<'a>(&mut self, frame: Frame<'a>) -> io::Result<Frame<'a>> {
17 Ok(frame)
18 }
19
20 fn decode<'a>(&mut self, frame: Frame<'a>) -> io::Result<Frame<'a>> {
21 Ok(frame)
22 }
23}