changeset 29:666ff7459169

Implement Default for Options
author Lewin Bormann <lbo@spheniscida.de>
date Sun, 12 Jun 2016 14:29:52 +0200
parents 94a35a4649b3
children f8517432c11d
files src/types.rs
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/types.rs	Sun Jun 12 13:03:45 2016 +0200
+++ b/src/types.rs	Sun Jun 12 14:29:52 2016 +0200
@@ -51,6 +51,21 @@
     pub reuse_logs: bool, // pub filter_policy: FilterPolicy,
 }
 
+impl Default for Options<StandardComparator> {
+    fn default() -> Options<StandardComparator> {
+        Options {
+            cmp: StandardComparator,
+            create_if_missing: true,
+            error_if_exists: false,
+            paranoid_checks: false,
+            write_buffer_size: 4 << 20,
+            max_open_files: 1 << 10,
+            block_size: 4 << 10,
+            block_restart_interval: 16,
+            reuse_logs: false,
+        }
+    }
+}
 
 /// An extension of the standard `Iterator` trait that supports some methods necessary for LevelDB.
 /// This works because the iterators used are stateful and keep the last returned element.