<commit_before>use std::fmt;

use serde::de;
use serde::ser::{Serialize, Serializer};
use serde::de::{Deserialize, Deserializer, Visitor, Unexpected};

pub type Integer = i64;
pub type Float = f32;

#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
pub struct True; // TODO(knsd): Option<True> => bool?

impl Deserialize for True {
    fn deserialize<D>(deserializer: D) -> Result<True, D::Error> where D: Deserializer {
        struct TrueVisitor;

        impl Visitor for TrueVisitor {
            type Value = True;

            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
                formatter.write_str("true")
            }

            fn visit_bool<E>(self, value: bool) -> Result<True, E> where E: de::Error {
                match value {
                    true => Ok(True),
                    false => Err(E::invalid_value(Unexpected::Bool(value), &self))
                }
            }
        }

        deserializer.deserialize_bool(TrueVisitor)<commit_msg>docs: document primitive types<commit_after>use std::fmt;

use serde::de;
use serde::ser::{Serialize, Serializer};
use serde::de::{Deserialize, Deserializer, Visitor, Unexpected};

/// The Telegram `Integer`, currently i64.
pub type Integer = i64;

/// The Telegram `Float`, currently f32.
pub type Float = f32;

#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
pub struct True; // TODO(knsd): Option<True> => bool?

impl Deserialize for True {
    fn deserialize<D>(deserializer: D) -> Result<True, D::Error> where D: Deserializer {
        struct TrueVisitor;

        impl Visitor for TrueVisitor {
            type Value = True;

            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
                formatter.write_str("true")
            }

            fn visit_bool<E>(self, value: bool) -> Result<True, E> where E: de::Error {
                match value {
                    true => Ok(True),
                    false => Err(E::invalid_value(Unexpected::Bool(value), &self))
                }
            }
        }

        deserializer.deserialize_bool(TrueVisitor)
{'fraction_non_alphanumeric': 0.12983947119924458, 'fraction_numerical': 0.0056657223796034, 'mean_word_length': 2.4567699836867862, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 25, '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': '5688273', 'n_tokens_mistral': 628, 'n_tokens_neox': 612, 'n_words': 164}