Ensure worktree updates are applied in order
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
28ba49b47b
commit
8d06049124
6 changed files with 183 additions and 140 deletions
|
@ -4,13 +4,14 @@ pub mod test;
|
|||
use futures::Future;
|
||||
use std::{
|
||||
cmp::Ordering,
|
||||
ops::AddAssign,
|
||||
pin::Pin,
|
||||
task::{Context, Poll},
|
||||
};
|
||||
|
||||
pub fn post_inc(value: &mut usize) -> usize {
|
||||
pub fn post_inc<T: From<u8> + AddAssign<T> + Copy>(value: &mut T) -> T {
|
||||
let prev = *value;
|
||||
*value += 1;
|
||||
*value += T::from(1);
|
||||
prev
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue