Crates.io | deferrer |
lib.rs | deferrer |
version | 0.1.4 |
source | src |
created_at | 2021-01-06 08:27:44.673967 |
updated_at | 2021-01-20 08:51:02.387713 |
description | defer! macro for deferring functions. |
homepage | |
repository | |
max_upload_size | |
id | 332957 |
size | 2,978 |
defer!
macro for deferring functions.
use deferrer::*;
use std::cell::RefCell;
let mut s = RefCell::new(String::from("Hello"));
{
defer!( || s.borrow_mut().push_str(" world!") );
assert_eq!(*s.borrow(), "Hello");
}
assert_eq!(*s.borrow(), "Hello world!");