pub fn import(&mut self, hash: H, number: N, parent_hash: H) -> Option<ImportDisplaced<H, N>> {
		// avoid underflow for genesis.
		let displaced = if number != N::zero() {
			let new_number = Reverse(number.clone() - N::one());
			let was_displaced = self.remove_leaf(&new_number, &parent_hash);

			if was_displaced {
				self.pending_removed.push(parent_hash.clone());
				Some(ImportDisplaced {
					new_hash: hash.clone(),
					displaced: LeafSetItem {
						hash: parent_hash,
						number: new_number,
					},
				})
			} else {
				None
			}
		} else {
			None
		};

		self.insert_leaf(Reverse(number.clone()), hash.clone());
		self.pending_added.push(LeafSetItem { hash, number: Reverse(number) });
		displaced
	}
/// update the leaf list on import. returns a displaced leaf if there was one.
update the leaf list on import. returns a displaced leaf if there was one.
update the leaf list on import . returns a displaced leaf if there was one .
pub fn import(&mut self, hash: H, number: N, parent_hash: H) -> Option<ImportDisplaced<H, N>> {
		// avoid underflow for genesis.
		let displaced = if number != N::zero() {
			let new_number = Reverse(number.clone() - N::one());
			let was_displaced = self.remove_leaf(&new_number, &parent_hash);
			if was_displaced {
				self.pending_removed.push(parent_hash.clone());
				Some(ImportDisplaced {
					new_hash: hash.clone(),
					displaced: LeafSetItem {
						hash: parent_hash,
						number: new_number,
					},
				})
			} else {
				None
			}
		} else {
			None
		};
		self.insert_leaf(Reverse(number.clone()), hash.clone());
		self.pending_added.push(LeafSetItem { hash, number: Reverse(number) });
		displaced
	}
pub fn import ( & mut self , hash : H , number : N , parent_hash : H ) -> Option < ImportDisplaced < H , N > > { // avoid underflow for genesis. let displaced = if number != N :: zero ( ) { let new_number = Reverse ( number . clone ( ) - N :: one ( ) ) ; let was_displaced = self . remove_leaf ( & new_number , & parent_hash ) ; if was_displaced { self . pending_removed . push ( parent_hash . clone ( ) ) ; Some ( ImportDisplaced { new_hash : hash . clone ( ) , displaced : LeafSetItem { hash : parent_hash , number : new_number , } , } ) } else { None } } else { None } ; self . insert_leaf ( Reverse ( number . clone ( ) ) , hash . clone ( ) ) ; self . pending_added . push ( LeafSetItem { hash , number : Reverse ( number ) } ) ; displaced }
update the leaf list on import.
update the leaf list on import .
&mut self
hash
H
number
N
parent_hash
H
&mut self
hash
H
number
N
parent_hash
H