pub fn read_children<
	K: Eq + Hash + Clone + Encode + Decode,
	V: Eq + Hash + Clone + Encode + Decode,
>(db: &KeyValueDB, column: Option<u32>, prefix: &[u8], parent_hash: K) -> error::Result<Vec<V>> {
	let mut buf = prefix.to_vec();
	parent_hash.using_encoded(|s| buf.extend(s));

	let raw_val_opt = match db.get(column, &buf[..]) {
		Ok(raw_val_opt) => raw_val_opt,
		Err(_) => return Err(error::ErrorKind::Backend("Error reading value from database".into()).into()),
	};

	let raw_val = match raw_val_opt {
		Some(val) => val,
		None => return Ok(Vec::new()),
	};

	let children: Vec<V> = match Decode::decode(&mut &raw_val[..]) {
		Some(children) => children,
		None => return Err(error::ErrorKind::Backend("Error decoding children".into()).into()),
	};

	Ok(children)
}
/// Returns the hashes of the children blocks of the block with `parent_hash`.
Returns the hashes of the children blocks of the block with `parent_hash`.
Returns the hashes of the children blocks of the block with ` parent_hash ` .
pub fn read_children<
	K: Eq + Hash + Clone + Encode + Decode,
	V: Eq + Hash + Clone + Encode + Decode,
>(db: &KeyValueDB, column: Option<u32>, prefix: &[u8], parent_hash: K) -> error::Result<Vec<V>> {
	let mut buf = prefix.to_vec();
	parent_hash.using_encoded(|s| buf.extend(s));
	let raw_val_opt = match db.get(column, &buf[..]) {
		Ok(raw_val_opt) => raw_val_opt,
		Err(_) => return Err(error::ErrorKind::Backend("Error reading value from database".into()).into()),
	};
	let raw_val = match raw_val_opt {
		Some(val) => val,
		None => return Ok(Vec::new()),
	};
	let children: Vec<V> = match Decode::decode(&mut &raw_val[..]) {
		Some(children) => children,
		None => return Err(error::ErrorKind::Backend("Error decoding children".into()).into()),
	};
	Ok(children)
}
pub fn read_children < K : Eq + Hash + Clone + Encode + Decode , V : Eq + Hash + Clone + Encode + Decode , > ( db : & KeyValueDB , column : Option < u32 > , prefix : & [ u8 ] , parent_hash : K ) -> error :: Result < Vec < V > > { let mut buf = prefix . to_vec ( ) ; parent_hash . using_encoded ( | s | buf . extend ( s ) ) ; let raw_val_opt = match db . get ( column , & buf [ .. ] ) { Ok ( raw_val_opt ) => raw_val_opt , Err ( _ ) => return Err ( error :: ErrorKind :: Backend ( " " . into ( ) ) . into ( ) ) , } ; let raw_val = match raw_val_opt { Some ( val ) => val , None => return Ok ( Vec :: new ( ) ) , } ; let children : Vec < V > = match Decode :: decode ( & mut & raw_val [ .. ] ) { Some ( children ) => children , None => return Err ( error :: ErrorKind :: Backend ( " " . into ( ) ) . into ( ) ) , } ; Ok ( children ) }
Returns the hashes of the children blocks of the block with `parent_hash`.
Returns the hashes of the children blocks of the block with ` parent_hash ` .
db
&KeyValueDB
column
Option<u32>
prefix
&[u8]
parent_hash
K
db
&KeyValueDB
column
Option<u32>
prefix
&[u8]
parent_hash
K