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::sync::Arc; | |
use std::ops::Deref; | |
#[derive(Clone, Debug)] | |
pub struct BytesRef { | |
bytes: Arc<Vec<u8>>, | |
} | |
impl BytesRef { | |
pub fn value(&self) -> &[u8] { |
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
pub struct SelectIterator<'i, I> { | |
iters: Vec<&'i mut dyn Iterator<Item=I>> | |
} | |
pub fn select<'i, I>(iters: Vec<&'i mut dyn Iterator<Item=I>>) | |
-> SelectIterator<'i, I> | |
{ | |
SelectIterator { iters } | |
} |
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; | |
use std::cmp::Ord; | |
use std::collections::BinaryHeap; | |
use std::sync::mpsc::{channel, Receiver, RecvError, Sender, TryRecvError}; | |
pub struct PriorityReceiver<T> | |
where | |
T: Ord, | |
{ | |
internal: Receiver<T>, |
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::{Ref, RefCell}; | |
use std::collections::HashMap; | |
use std::rc::Rc; | |
#[derive(Debug)] | |
struct Key<'b> { | |
k: Ref<'b, String>, | |
} | |
impl<'b> Key<'b> { |
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::borrow::Cow; | |
use std::collections::HashMap; | |
#[derive(Eq, PartialEq, Hash, Clone, Default, Debug)] | |
struct Symbol<'a> { | |
ns: Cow<'a, str>, | |
name: Cow<'a, str>, | |
} | |
impl<'a> Symbol<'a> { |
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(Default)] | |
struct X { | |
a: String, | |
b: String, | |
c: String, | |
} | |
macro_rules! reject_empty { | |
($obj:ident, $first_field:tt, $($field:tt),*) => { | |
{ |
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::collections::HashMap; | |
use std::sync::Arc; | |
use std::sync::Mutex; | |
#[derive(Default)] | |
struct StringManagerPrimative { | |
pub map: HashMap<String, String>, | |
} | |
impl StringManagerPrimative { |