Improve documentation

This commit is contained in:
Gwenael Treguier 2015-08-08 16:33:08 +02:00
parent 25de884720
commit a470499dcb

View File

@ -1,9 +1,11 @@
//! Prepared statements cache for faster execution.
extern crate lru_cache; extern crate lru_cache;
use {SqliteResult, SqliteConnection, SqliteStatement}; use {SqliteResult, SqliteConnection, SqliteStatement};
use self::lru_cache::LruCache; use self::lru_cache::LruCache;
/// Prepared statements are cached for faster execution. /// Prepared statements cache.
///
/// FIXME limitation: the same SQL can be cached only once... /// FIXME limitation: the same SQL can be cached only once...
#[derive(Debug)] #[derive(Debug)]
pub struct StatementCache<'conn> { pub struct StatementCache<'conn> {
@ -12,6 +14,7 @@ pub struct StatementCache<'conn> {
} }
impl<'conn> StatementCache<'conn> { impl<'conn> StatementCache<'conn> {
/// Create a statement cache.
pub fn new(conn: &'conn SqliteConnection, capacity: usize) -> StatementCache<'conn> { pub fn new(conn: &'conn SqliteConnection, capacity: usize) -> StatementCache<'conn> {
StatementCache{ conn: conn, cache: LruCache::new(capacity) } StatementCache{ conn: conn, cache: LruCache::new(capacity) }
} }