Relax the requirement of Atom::with.

This commit is contained in:
Xidorn Quan 2017-05-16 09:47:23 +10:00
parent 9354e90afc
commit 0667287bf6
4 changed files with 4 additions and 4 deletions

View file

@ -198,7 +198,7 @@ impl fmt::Display for WeakAtom {
impl Atom {
/// Execute a callback with the atom represented by `ptr`.
pub unsafe fn with<F, R: 'static>(ptr: *mut nsIAtom, callback: &mut F) -> R where F: FnMut(&Atom) -> R {
pub unsafe fn with<F, R>(ptr: *mut nsIAtom, callback: F) -> R where F: FnOnce(&Atom) -> R {
let atom = Atom(WeakAtom::new(ptr));
let ret = callback(&atom);
mem::forget(atom);