Skip to main content

Module bytes_util

Module bytes_util 

Source
Expand description

Bytes Util Module

Functionsยง

bytes32_to_hex_string
Convert a [u8; 32] to a bytes string.
deploy_bootstrap
Builds the deployment bootstrap that copies the runtime code into memory and returns it
format_even_bytes
Pad odd-length byte string with a leading 0
format_literal
Converts a literal into its bytecode string representation
format_push0 ๐Ÿ”’
Formats a PUSH0 opcode if supported by the EVM version, otherwise falls back to PUSH1 0x00
hex_to_usize
Wrapper to convert a hex string to a usize.
literal_gen
Converts a value literal to its smallest equivalent PUSHX bytecode. Leading zeros are removed.
pad_n_bytes
Pad a hex string with n 0 bytes to the left. Will not pad a hex string that has a length greater than or equal to num_bytes * 2
push_min_width ๐Ÿ”’
Hex-encodes value as the smallest PUSHn (n >= 1) that holds it
str_to_bytes32
Convert a string slice to a [u8; 32] Pads zeros to the left of significant bytes in the [u8; 32] slice. i.e. 0xa57b becomes [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 165, 123]
str_to_vec
Convert string slice to Vec<u8>, size not capped