pub struct Task {
pub state: Arc<AtomicU128>,
}Fields§
§state: Arc<AtomicU128>Implementations§
Source§impl Task
impl Task
pub fn new(range: Range<u64>) -> Self
pub fn get(&self) -> Range<u64>
pub fn set(&self, range: Range<u64>)
pub fn start(&self) -> u64
Sourcepub fn safe_add_start(
&self,
start: u64,
bias: u64,
) -> Result<Range<u64>, RangeError>
pub fn safe_add_start( &self, start: u64, bias: u64, ) -> Result<Range<u64>, RangeError>
当 start + bias <= old_start 时返回 RangeError 否则返回 old_start..new_start.min(end)
pub fn end(&self) -> u64
pub fn remain(&self) -> u64
Sourcepub fn split_two(&self) -> Result<Option<Range<u64>>, RangeError>
pub fn split_two(&self) -> Result<Option<Range<u64>>, RangeError>
- 当 start > end 时返回 RangeError
- 当 remain < 2 时返回 None 并且不会修改自己
pub fn take(&self) -> Option<Range<u64>>
pub fn downgrade(&self) -> WeakTask
pub fn strong_count(&self) -> usize
pub fn weak_count(&self) -> usize
Trait Implementations§
impl Eq for Task
Auto Trait Implementations§
impl Freeze for Task
impl RefUnwindSafe for Task
impl Send for Task
impl Sync for Task
impl Unpin for Task
impl UnsafeUnpin for Task
impl UnwindSafe for Task
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more