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::env; | |
use std::process::exit; | |
use std::str::Chars; | |
use std::iter::Peekable; | |
#[derive(Debug, PartialEq, Eq)] | |
enum LispExpr { | |
Integer(u64), | |
Operator(String), | |
SubExpr(Vec<LispExpr>), |
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 trait AsRev { | |
fn as_rev(&self) -> &ListItem; | |
} | |
impl AsRev for ListItem { | |
fn as_rev(&self) -> &ListItem { | |
&self | |
} | |
} |
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 ListItems<'a, I, F1, F2, F3> | |
where I: Iterator | |
{ | |
codemap: &'a CodeMap, | |
inner: Peekable<I>, | |
get_lo: F1, | |
get_hi: F2, | |
get_item_string: F3, | |
prev_span_end: BytePos, | |
next_span_start: BytePos, |
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
Return-Path: <[email protected]> | |
X-Original-To: [email protected] | |
Delivered-To: [email protected] | |
Received: by marcusklaas.nl (Postfix, from userid 1005) | |
id 80A981A0330; Mon, 10 Aug 2015 23:34:32 +0200 (CEST) | |
Received: from localhost by VBND001.cs1local | |
with SpamAssassin (version 3.4.0); | |
Mon, 10 Aug 2015 23:34:32 +0200 | |
From: "MICHAEL SMITH"<[email protected]> | |
To: undisclosed-recipients:; |
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
/// A trait for types that can be created from a SQLite value. | |
pub trait FromSql { | |
unsafe fn column_result(stmt: *mut sqlite3_stmt, col: c_int) -> SqliteResult<Self>; | |
} | |
impl<'a, T> FromSql for T where T: convert::From<&'a str> { | |
unsafe fn column_result(stmt: *mut sqlite3_stmt, col: c_int) -> SqliteResult<T> { | |
let c_text = ffi::sqlite3_column_text(stmt, col); | |
if c_text.is_null() { | |
Ok(T::from("")) |
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 fn query_and_collect<T, F, C>(&self, sql: &str, params: &[&ToSql], f: F) -> SqliteResult<C> | |
where F: Fn(SqliteRow) -> T + Copy, // FIXME: is the Copy really necessary? | |
C: FromIterator<T> { | |
let mut statement = try!(self.prepare(sql)); | |
statement | |
.query(params) | |
.and_then(|rows| { | |
rows | |
.map(|row| { |