<commit_before>#![recursion_limit = "1024"]

#[macro_use] extern crate error_chain;
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate log;
extern crate env_logger;
extern crate chrono;
extern crate hex;
extern crate uuid;
extern crate ring;
extern crate crypto;
extern crate r2d2;
extern crate r2d2_postgres;
extern crate postgres;
extern crate migrant_lib;
extern crate ron;
extern crate serde;
#[macro_use] extern crate serde_derive;
#[macro_use] extern crate serde_json;
extern crate serde_urlencoded;
#[macro_use] extern crate rouille;
extern crate xdg;

#[macro_use] pub mod macros;
pub mod service;
pub mod sweep;
pub mod handlers;
pub mod db;
pub mod models;
pub mod auth;
pub mod errors;
pub mod admin;


use std::io::Read;
use errors::*;
pub use models::CONFIG;

pub static APPNAME: &'static str = "Transfer";


pub fn config_dir() -> Result<std::path::PathBuf> {
    let xdg_dirs = xdg::BaseDirectories::with_prefix("transfer")?;
    let config_dir = xdg_dirs.create_config_directory("config")?;
    Ok(config_dir)
}


// ------------------------------------------------
// Traits for augmenting `rouille`
// ------------------------------------------------

/// Trait for parsing `json` from `rouille::Request` bodies into some type `T`
///
/// # Example
///
/// ```rust,ignore
/// #[derive(Deserialize)]
/// struct PostData {
///     name: String,
///     age: u32,
/// }
///```
///
/// For a request with a body containing `json`
///
/// ```rust,ignore
/// let post_data = request.parse_json_body::<PostData>()?;
/// println!("{}", post_data.name);
/// ```
pub trait FromRequestBody {
    fn parse_json_body<T: serde::de::DeserializeOwned>(&self) -> Result<T>;
}

impl FromRequestBody for rouille::Request {<commit_msg>change config dir<commit_after>#![recursion_limit = "1024"]

#[macro_use] extern crate error_chain;
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate log;
extern crate env_logger;
extern crate chrono;
extern crate hex;
extern crate uuid;
extern crate ring;
extern crate crypto;
extern crate r2d2;
extern crate r2d2_postgres;
extern crate postgres;
extern crate migrant_lib;
extern crate ron;
extern crate serde;
#[macro_use] extern crate serde_derive;
#[macro_use] extern crate serde_json;
extern crate serde_urlencoded;
#[macro_use] extern crate rouille;
extern crate xdg;

#[macro_use] pub mod macros;
pub mod service;
pub mod sweep;
pub mod handlers;
pub mod db;
pub mod models;
pub mod auth;
pub mod errors;
pub mod admin;


use std::io::Read;
use errors::*;
pub use models::CONFIG;

pub static APPNAME: &'static str = "Transfer";


pub fn config_dir() -> Result<std::path::PathBuf> {
    let xdg_dirs = xdg::BaseDirectories::with_prefix("transfer")?;
    let config_dir = xdg_dirs.create_config_directory("")?;
    Ok(config_dir)
}


// ------------------------------------------------
// Traits for augmenting `rouille`
// ------------------------------------------------

/// Trait for parsing `json` from `rouille::Request` bodies into some type `T`
///
/// # Example
///
/// ```rust,ignore
/// #[derive(Deserialize)]
/// struct PostData {
///     name: String,
///     age: u32,
/// }
///```
///
/// For a request with a body containing `json`
///
/// ```rust,ignore
/// let post_data = request.parse_json_body::<PostData>()?;
/// println!("{}", post_data.name);
/// ```
pub trait FromRequestBody {
    fn parse_json_body<T: serde::de::DeserializeOwned>(&self) -> Result<T>;
}

impl FromRequestBody for rouille::Request {
{'fraction_non_alphanumeric': 0.1981672394043528, 'fraction_numerical': 0.0057273768613974796, 'mean_word_length': 3.3176761433868975, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '2034146', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1121, 'n_words': 340}