Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
R
rust-rocksdb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangzongwu
rust-rocksdb
Commits
60a8d9a2
Commit
60a8d9a2
authored
Nov 28, 2014
by
Tyler Neely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add on_error functionality to README.md
parent
3287c196
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
README.md
README.md
+3
-1
main.rs
src/main.rs
+6
-4
No files found.
README.md
View file @
60a8d9a2
...
...
@@ -23,7 +23,9 @@ fn main() {
None
=>
println!
(
"did not read valid utf-8 out of the db"
),
}
})
.on_absent
(||
{
println!
(
"value not found"
)
});
})
.on_absent
(
||
{
println!
(
"value not found"
)
})
.on_error
(
|
e
|
{
println!
(
"error retrieving value: {}"
,
e
)
});
db
.delete
(
b
"my key"
);
...
...
src/main.rs
View file @
60a8d9a2
...
...
@@ -7,18 +7,20 @@ use test::Bencher;
fn
main
()
{
match
rocksdb
::
create_or_open
(
"/tmp/rust-rocksdb"
.to_string
())
{
Ok
(
db
)
=>
{
db
.put
(
b
"my key"
,
b
"my value"
);
assert
!
(
db
.put
(
b
"my key"
,
b
"my value"
)
.is_ok
()
);
db
.get
(
b
"my key"
)
.map
(
|
value
|
{
match
value
.to_utf8
()
{
Some
(
v
)
=>
println!
(
"retrieved utf8 value {}"
,
v
),
println!
(
"retrieved utf8 value
:
{}"
,
v
),
None
=>
println!
(
"did not read valid utf-8 out of the db"
),
}
})
.on_absent
(||
{
println!
(
"value not found"
)
});
})
.on_absent
(
||
{
println!
(
"value not found"
)
})
.on_error
(
|
e
|
{
println!
(
"error retrieving value: {}"
,
e
)
});
db
.delete
(
b
"my key"
);
assert
!
(
db
.delete
(
b
"my key"
)
.is_ok
()
);
db
.close
();
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment