Converted to sqlez, so much nicer
This commit is contained in:
parent
c8face33fa
commit
406663c75e
12 changed files with 278 additions and 197 deletions
|
@ -204,6 +204,13 @@ impl<T: Rng> Iterator for RandomCharIter<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! iife {
|
||||
($block:block) => {
|
||||
(|| $block)()
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
@ -221,4 +228,18 @@ mod tests {
|
|||
extend_sorted(&mut vec, vec![1000, 19, 17, 9, 5], 8, |a, b| b.cmp(a));
|
||||
assert_eq!(vec, &[1000, 101, 21, 19, 17, 13, 9, 8]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_iife() {
|
||||
fn option_returning_function() -> Option<()> {
|
||||
None
|
||||
}
|
||||
|
||||
let foo = iife!({
|
||||
option_returning_function()?;
|
||||
Some(())
|
||||
});
|
||||
|
||||
assert_eq!(foo, None);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue