pub fn encode(tokens: &[Token]) -> Bytes {
	let mediates: Vec<Mediate> = tokens.iter().map(encode_token).collect();

	let inits = mediates
		.iter()
		.enumerate()
		.flat_map(|(i, m)| m.init(Mediate::offset_for(&mediates, i)));

	let closings = mediates
		.iter()
		.enumerate()
		.flat_map(|(i, m)| m.closing(Mediate::offset_for(&mediates, i)));

	inits
		.chain(closings)
		.flat_map(|item| item.to_vec())
		.collect()
}
/// Encodes vector of tokens into ABI compliant vector of bytes.
Encodes vector of tokens into ABI compliant vector of bytes.
Encodes vector of tokens into ABI compliant vector of bytes .
pub fn encode(tokens: &[Token]) -> Bytes {
	let mediates: Vec<Mediate> = tokens.iter().map(encode_token).collect();
	let inits = mediates
		.iter()
		.enumerate()
		.flat_map(|(i, m)| m.init(Mediate::offset_for(&mediates, i)));
	let closings = mediates
		.iter()
		.enumerate()
		.flat_map(|(i, m)| m.closing(Mediate::offset_for(&mediates, i)));
	inits
		.chain(closings)
		.flat_map(|item| item.to_vec())
		.collect()
}
pub fn encode ( tokens : & [ Token ] ) -> Bytes { let mediates : Vec < Mediate > = tokens . iter ( ) . map ( encode_token ) . collect ( ) ; let inits = mediates . iter ( ) . enumerate ( ) . flat_map ( | ( i , m ) | m . init ( Mediate :: offset_for ( & mediates , i ) ) ) ; let closings = mediates . iter ( ) . enumerate ( ) . flat_map ( | ( i , m ) | m . closing ( Mediate :: offset_for ( & mediates , i ) ) ) ; inits . chain ( closings ) . flat_map ( | item | item . to_vec ( ) ) . collect ( ) }
Encodes vector of tokens into ABI compliant vector of bytes.
Encodes vector of tokens into ABI compliant vector of bytes .
tokens
&[Token]
tokens
&[Token]