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.
rust-rocksdb/tests/test_pinnable_slice.rs

26 lines
557 B

mod util;
use crate::util::DBPath;
use rocksdb::{Options, DB};
#[test]
fn test_pinnable_slice() {
let path = DBPath::new("_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]);
}