<commit_before>// Copyright 2016 Google Inc. All Rights Reserved.
//
// Licensed under the MIT License, <LICENSE or http://opensource.org/licenses/MIT>.
// This file may not be copied, modified, or distributed except according to those terms.

use bincode::{SizeLimit, serde as bincode};
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use futures::{Async, Poll};
use serde;
use std::io::{self, Cursor};
use std::marker::PhantomData;
use std::mem;
use tokio_core::easy::{self, EasyBuf, EasyFramed};
use tokio_core::io::{FramedIo, Io};
use tokio_proto::multiplex::{self, RequestId};
use util::Never;

/// Handles the IO of tarpc messages.
pub struct Framed<I, In, Out> {
    inner: EasyFramed<I, Parser<Out>, Serializer<In>>,
}

impl<I, In, Out> Framed<I, In, Out> {
    /// Constructs a new tarpc FramedIo
    pub fn new(upstream: I) -> Framed<I, In, Out>
        where I: Io,
              In: serde::Serialize,
              Out: serde::Deserialize
    {
        Framed { inner: EasyFramed::new(upstream, Parser::new(), Serializer::new()) }
    }
}
<commit_msg>Elaborate in the doc comment for Framed<commit_after>// Copyright 2016 Google Inc. All Rights Reserved.
//
// Licensed under the MIT License, <LICENSE or http://opensource.org/licenses/MIT>.
// This file may not be copied, modified, or distributed except according to those terms.

use bincode::{SizeLimit, serde as bincode};
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use futures::{Async, Poll};
use serde;
use std::io::{self, Cursor};
use std::marker::PhantomData;
use std::mem;
use tokio_core::easy::{self, EasyBuf, EasyFramed};
use tokio_core::io::{FramedIo, Io};
use tokio_proto::multiplex::{self, RequestId};
use util::Never;

/// Handles the IO of tarpc messages. Similar to `tokio_core::easy::EasyFramed` except that it
/// hardcodes a parser and serializer suitable for tarpc messages.
pub struct Framed<I, In, Out> {
    inner: EasyFramed<I, Parser<Out>, Serializer<In>>,
}

impl<I, In, Out> Framed<I, In, Out> {
    /// Constructs a new tarpc FramedIo
    pub fn new(upstream: I) -> Framed<I, In, Out>
        where I: Io,
              In: serde::Serialize,
              Out: serde::Deserialize
    {
        Framed { inner: EasyFramed::new(upstream, Parser::new(), Serializer::new()) }
    }
}

{'fraction_non_alphanumeric': 0.14385353095030515, 'fraction_numerical': 0.0034873583260680036, 'mean_word_length': 4.043956043956044, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2302235', 'n_tokens_mistral': 756, 'n_tokens_neox': 759, 'n_words': 237}