mnemonikr / symbolic-pcode

Apache License 2.0
0 stars 0 forks source link

Use FromIterator for conversions #89

Closed mnemonikr closed 8 months ago

mnemonikr commented 8 months ago

Several collection conversions expected the SymbolicByte to be held in a Vec, but there was no real reason for this expectation. This changes the conversions from From<Vec<...>> to FromIterator<...>. The calling code that current holds a Vec then calls with into_iter().collect() instead of .into().

This opens up the code to being able to use different collections instead of being beholden to Vec due to the convenient conversion routines.

mnemonikr commented 8 months ago

This also replaced a conversion from a Vec<u8> into an iterator of LittleEndian<u8>. This is a new type introduced to ensure that the caller using concrete bytes knows the data must be in little-endian format. This is to prevent mistakes like 300u16.to_be_bytes().into_iter().collect::<SymbolicBitVec>()