This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::{cell::RefCell, rc::Rc}; | |
use neure::{err::Error, prelude::*, re::rec_parser}; | |
use re::RecursiveCtor; | |
static JSON: &'static [u8] = include_bytes!("../sample.json"); | |
fn main() -> color_eyre::Result<()> { | |
color_eyre::install()?; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use neure::*; | |
const KEY_ANYWHERE: usize = 0; | |
const KEY_PLUS: usize = 1; | |
const KEY_SUB: usize = 2; | |
const KEY_SEQ: usize = 3; | |
const KEY_START: usize = 4; | |
const KEY_END: usize = 5; | |
const KEY_RANGE: usize = 6; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod thread_pool { | |
use std::{ | |
fmt::Display, | |
ops::{Deref, DerefMut}, | |
sync::{ | |
mpsc::{channel, Sender}, | |
Arc, Mutex, MutexGuard, OnceLock, | |
}, | |
thread::{spawn, JoinHandle}, | |
time::Duration, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate syn; | |
use std::iter::FromIterator; | |
use proc_macro2::Ident; | |
use proc_macro2::TokenStream; | |
use proc_macro_error::abort; | |
use quote::TokenStreamExt; | |
use quote::{quote, ToTokens}; | |
use syn::GenericArgument; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57,124,190,177,41,30,2,6,57,11,193,84,39,27,2,2,2,2,2,2,37,2,2,2,2,2,2,2,78,105,151,122,226,164,220,25,234,95,2,60,158,202,203,22,204,82,139,173,83,88,233,180,137,20,190,199,229,197,131,131,41,237,225,199,165,31,80,63,121,106,88,41,245,207,62,257,203,235,113,63,44,145,194,195,223,134,50,231,15,72,244,71,116,2,247,60,247,120,211,171,234,108,235,106,52,44,186,16,128,247,168,166,135,7,99,78,113,85,229,36,118,58,155,35,160,196,184,174,3,47,38,88,204,210,171,109,137,223,244,112,235,115,33,192,157,109,226,152,174,173,132,246,110,117,17,228,40,50,71,182,72,221,123,130,82,178,255,230,22,52,55,145,105,214,82,137,240,159,64,102,131,55,210,212,63,51,147,124,228,65,100,164,227,129,165,72,9,71,157,64,37,218,144,130,131,4,17,140,227,33,179,152,71,195,74,4,177,51,190,136,256,242,13,211,165,235,56,69,48,46,115,168,159,149,81,175,172,249,230,170,150,147,219,39,25,121,184,31,178,12,230,211,163,208,6,106,207,160,196,106,92,69,43,108,206,9,135,8,198,126,119,196,87,69,113,188,253,203,88,14,79,244,164,193,126,157,86,202,250,247,18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <fcntl.h> | |
#include <fileapi.h> | |
#include <fstream> | |
#include <io.h> | |
#include <iostream> | |
#include <locale> | |
#include <sstream> | |
#include <string> | |
#include <vector> | |
#include <windows.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Debug)] | |
pub struct Equal(i64); | |
#[derive(Debug)] | |
pub struct Bigger(i64); | |
pub trait Policy: std::fmt::Debug { | |
fn parse(&self, val: i64) -> Result<Option<i64>, String>; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use futures::Future; // 0.3.25 | |
use std::pin::Pin; | |
use std::{ | |
collections::VecDeque, | |
fs::FileType, | |
path::{Path, PathBuf}, | |
time::Duration, | |
}; | |
use tokio::{ | |
sync::mpsc::{channel, Receiver, Sender}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn merge_sort<T>(vals: &mut Vec<T>, beg: usize, end: usize) | |
where | |
T: Default + Copy + PartialOrd, | |
{ | |
let mid = (beg + end) / 2; | |
if beg < end { | |
merge_sort(vals, beg, mid); | |
merge_sort(vals, mid + 1, end); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn quick_select<T: Debug + Clone + PartialOrd>(vals: &mut Vec<T>, pos: usize, beg: usize, end: usize) -> Option<&T> { | |
if beg == end { | |
return vals.get(pos); | |
} | |
else { | |
let pivot = end - 1; | |
let mut swap_idx = beg; | |
// swap the pivot to end | |
vals.swap(beg, pivot); |