fn add(&mut self, chunk: UnlockingChunk<Balance>) {
		// It is possible that the unbonding period changes so we need to account for that
		match self.unlocking_chunks.binary_search_by(|x| x.unlock_era.cmp(&chunk.unlock_era)) {
			// Merge with existing chunk if unlock_eras match
			Ok(pos) => self.unlocking_chunks[pos].add_amount(chunk.amount),
			// Otherwise insert where it should go. Note that this will in almost all cases return
			// the last index.
			Err(pos) => self.unlocking_chunks.insert(pos, chunk),
		}
	}
/// Adds a new unlocking chunk to the vector, preserving the unlock_era based ordering.
Adds a new unlocking chunk to the vector, preserving the unlock_era based ordering.
Adds a new unlocking chunk to the vector preserving the unlock_era based ordering .
fn add(&mut self, chunk: UnlockingChunk<Balance>) {
		// It is possible that the unbonding period changes so we need to account for that
		match self.unlocking_chunks.binary_search_by(|x| x.unlock_era.cmp(&chunk.unlock_era)) {
			// Merge with existing chunk if unlock_eras match
			Ok(pos) => self.unlocking_chunks[pos].add_amount(chunk.amount),
			// Otherwise insert where it should go. Note that this will in almost all cases return
			// the last index.
			Err(pos) => self.unlocking_chunks.insert(pos, chunk),
		}
	}
fn add ( & mut self , chunk : UnlockingChunk < Balance > ) { // It is possible that the unbonding period changes so we need to account for that match self . unlocking_chunks . binary_search_by ( | x | x . unlock_era . cmp ( & chunk . unlock_era ) ) { // Merge with existing chunk if unlock_eras match Ok ( pos ) => self . unlocking_chunks [ pos ] . add_amount ( chunk . amount ) , // Otherwise insert where it should go. Note that this will in almost all cases return // the last index. Err ( pos ) => self . unlocking_chunks . insert ( pos , chunk ) , } }
Adds a new unlocking chunk to the vector, preserving the unlock_era based ordering.
Adds a new unlocking chunk to the vector preserving the unlock_era based ordering .
&mut self
chunk
UnlockingChunk<Balance>