Skip to content

Commit 86d8916

Browse files
author
Seulgi Kim
committed
Update the description
1 parent 743720e commit 86d8916

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
[package]
22
name = "finally-block"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
authors = ["Seulgi Kim <[email protected]>"]
55
edition = "2018"
66
license = "MIT"
77
repository = "http://github.com/CodeChain-io/rust-finally-block"
88
keywords = ["control", "raii", "finally", "block"]
9+
description = """
10+
Final block is a block that is executed when it dropped.
11+
It helps a user to write the deferred statements that should be executed even some statements return early.
12+
"""
913

1014
[dependencies]

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
# finally-block [![Build Status](https://travis-ci.com/CodeChain-io/rust-finally-block.svg?branch=master)](https://travis-ci.com/CodeChain-io/rust-finally-block) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
22

3-
An emulation of finally block.
3+
Final block is a block that is executed when it dropped.
4+
It helps a user to write the deferred statements that should be executed even some statements return early.
5+
6+
```rust
7+
function f(flag: &AtomicBool) -> Option<()> {
8+
if some_condition {
9+
let _f = finally(|| {
10+
flag.store(true, Ordering::SeqCst);
11+
});
12+
some_function(flag)?;
13+
} else {
14+
another_function()?;
15+
}
16+
}
17+
```

0 commit comments

Comments
 (0)