mirror of https://github.com/chipsenkbeil/distant
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
509 B
Rust
24 lines
509 B
Rust
use std::io;
|
|
|
|
use super::{Codec, Frame};
|
|
|
|
/// Represents a codec that does not alter the frame (synonymous with "plain text")
|
|
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
|
|
pub struct PlainCodec;
|
|
|
|
impl PlainCodec {
|
|
pub fn new() -> Self {
|
|
Self::default()
|
|
}
|
|
}
|
|
|
|
impl Codec for PlainCodec {
|
|
fn encode<'a>(&mut self, frame: Frame<'a>) -> io::Result<Frame<'a>> {
|
|
Ok(frame)
|
|
}
|
|
|
|
fn decode<'a>(&mut self, frame: Frame<'a>) -> io::Result<Frame<'a>> {
|
|
Ok(frame)
|
|
}
|
|
}
|