fn deep_decompress(rlp: &UntrustedRlp, swapper: &InvalidRlpSwapper) -> Option<ElasticArray1024<u8>> {
	let simple_swap = ||
		swapper.get_valid(rlp.as_raw()).map(to_elastic);
	// Simply decompress data.
	if rlp.is_data() { return simple_swap(); }
	match rlp.item_count().unwrap_or(0) {
		// Look for special compressed list, which contains nested data.
		2 if rlp.at(0).map(|r| r.as_raw() == &[0x81, 0x7f]).unwrap_or(false) =>
			rlp.at(1).ok().map_or(simple_swap(),
			|r| deep_decompress(&r, swapper).map(|d| { let v = d.to_vec(); encode(&v) })),
		// Iterate through RLP while checking if it has been compressed.
		_ => map_rlp(rlp, |r| deep_decompress(r, swapper)),
  	}
}
/// Recover valid RLP from a compressed form, None if no decompression achieved.
/// Tries to decompress compressed data insides.
Recover valid RLP from a compressed form, None if no decompression achieved.
Tries to decompress compressed data insides.
Recover valid RLP from a compressed form None if no decompression achieved . Tries to decompress compressed data insides .
fn deep_decompress(rlp: &UntrustedRlp, swapper: &InvalidRlpSwapper) -> Option<ElasticArray1024<u8>> {
	let simple_swap = ||
		swapper.get_valid(rlp.as_raw()).map(to_elastic);
	// Simply decompress data.
	if rlp.is_data() { return simple_swap(); }
	match rlp.item_count().unwrap_or(0) {
		// Look for special compressed list, which contains nested data.
		2 if rlp.at(0).map(|r| r.as_raw() == &[0x81, 0x7f]).unwrap_or(false) =>
			rlp.at(1).ok().map_or(simple_swap(),
			|r| deep_decompress(&r, swapper).map(|d| { let v = d.to_vec(); encode(&v) })),
		// Iterate through RLP while checking if it has been compressed.
		_ => map_rlp(rlp, |r| deep_decompress(r, swapper)),
  	}
}
fn deep_decompress ( rlp : & UntrustedRlp , swapper : & InvalidRlpSwapper ) -> Option < ElasticArray1024 < u8 > > { let simple_swap = | | swapper . get_valid ( rlp . as_raw ( ) ) . map ( to_elastic ) ; // Simply decompress data. if rlp . is_data ( ) { return simple_swap ( ) ; } match rlp . item_count ( ) . unwrap_or ( 0 ) { // Look for special compressed list, which contains nested data. 2 if rlp . at ( 0 ) . map ( | r | r . as_raw ( ) == & [ 0x81 , 0x7f ] ) . unwrap_or ( false ) => rlp . at ( 1 ) . ok ( ) . map_or ( simple_swap ( ) , | r | deep_decompress ( & r , swapper ) . map ( | d | { let v = d . to_vec ( ) ; encode ( & v ) } ) ) , // Iterate through RLP while checking if it has been compressed. _ => map_rlp ( rlp , | r | deep_decompress ( r , swapper ) ) , } }
Recover valid RLP from a compressed form, None if no decompression achieved.
Recover valid RLP from a compressed form None if no decompression achieved .
rlp
&UntrustedRlp
swapper
&InvalidRlpSwapper