fork of https://github.com/rust-rocksdb/rust-rocksdb for nextgraph
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
538 B
25 lines
538 B
6 years ago
|
extern crate rocksdb;
|
||
|
|
||
|
use rocksdb::{Options, DB};
|
||
|
|
||
|
#[test]
|
||
|
pub fn test_pinnable_slice() {
|
||
|
let path = "_rust_rocksdb_pinnable_slice_test";
|
||
|
|
||
|
let mut opts = Options::default();
|
||
|
opts.create_if_missing(true,);
|
||
|
let db = DB::open(&opts, path,).unwrap();
|
||
|
|
||
|
db.put(b"k1", b"value12345",).unwrap();
|
||
|
|
||
|
let result = db.get_pinned(b"k1",);
|
||
|
assert!(result.is_ok());
|
||
|
|
||
|
let value = result.unwrap();
|
||
|
assert!(value.is_some());
|
||
|
|
||
|
let pinnable_slice = value.unwrap();
|
||
|
|
||
|
assert_eq!(b"12345", &pinnable_slice[5..10]);
|
||
|
}
|