Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

ByteArrayTraitExtImpl

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl

pub impl ByteArrayTraitExtImpl of ByteArrayTraitExt;

Impl functions

new

Create a ByteArray from an array of u128

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::new

fn new(mut data: Array<u128>) -> ByteArray

new_empty

instantiate a new ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::new_empty

fn new_empty() -> ByteArray

size

get size. Same as len()

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::size

fn size(self: @ByteArray) -> u32

read_u8

Read a u8 from ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::read_u8

fn read_u8(self: @ByteArray, offset: u32) -> (u32, u8)

read_u16

Read a u16 from ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::read_u16

fn read_u16(self: @ByteArray, offset: u32) -> (u32, u16)

read_u32

Read a u32 from ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::read_u32

fn read_u32(self: @ByteArray, offset: u32) -> (u32, u32)

read_usize

Read a usize from ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::read_usize

fn read_usize(self: @ByteArray, offset: u32) -> (u32, u32)

read_u64

Read a u64 from ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::read_u64

fn read_u64(self: @ByteArray, offset: u32) -> (u32, u64)

read_u128

Read a u128 from ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::read_u128

fn read_u128(self: @ByteArray, offset: u32) -> (u32, u128)

read_u128_packed

Read value with size bytes from ByteArray, and packed into u128

Arguments:

  • offset: the offset in Bytes
  • size: the number of bytes to read

Returns:

  • new_offset: next value offset in Bytes
  • value: the value packed into u128

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::read_u128_packed

fn read_u128_packed(self: @ByteArray, offset: u32, size: u32) -> (u32, u128)

read_u256

Read a u256 from ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::read_u256

fn read_u256(self: @ByteArray, offset: u32) -> (u32, u256)

read_felt252_packed

Read value with size bytes from ByteArray, and packed into felt252

Arguments:

  • offset: the offset in Bytes
  • size: the number of bytes to read

Returns:

  • new_offset: next value offset in Bytes
  • value: the value packed into felt252

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::read_felt252_packed

fn read_felt252_packed(self: @ByteArray, offset: u32, size: u32) -> (u32, felt252)

read_felt252

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::read_felt252

fn read_felt252(self: @ByteArray, offset: u32) -> (u32, felt252)

read_bytes31

Read a bytes31 from ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::read_bytes31

fn read_bytes31(self: @ByteArray, offset: u32) -> (u32, bytes31)

read_address

Read Contract Address from Bytes

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::read_address

fn read_address(self: @ByteArray, offset: u32) -> (u32, ContractAddress)

read_bytes

Read bytes from ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::read_bytes

fn read_bytes(self: @ByteArray, offset: u32, size: u32) -> (u32, ByteArray)

read_u128_array_packed

Read an array of u128 values from ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::read_u128_array_packed

fn read_u128_array_packed(
    self: @ByteArray, offset: u32, array_length: u32, element_size: u32,
) -> (u32, Array<u128>)

read_u256_array

Read an array of u256 values from ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::read_u256_array

fn read_u256_array(self: @ByteArray, offset: u32, array_length: u32) -> (u32, Array<u256>)

read_uint_within_size

Reads an unsigned integer of type T from the ByteArray starting at a given offset, with a specified size.

Inputs:

  • self: A reference to the ByteArray from which to read.
  • offset: The starting position in the ByteArray to begin reading.
  • size: The number of bytes to read.

Outputs:

  • A tuple containing:
    • The new offset after reading the specified number of bytes.
    • The value of type T read from the ByteArray.

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::read_uint_within_size

fn read_uint_within_size(self: @ByteArray, offset: u32, size: u32) -> (u32, T)

append_u8

Append a u8 to ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::append_u8

fn append_u8(ref self: ByteArray, value: u8)

append_u16

Append a u16 to ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::append_u16

fn append_u16(ref self: ByteArray, value: u16)

append_u16_le

Append a u16 to ByteArray in little-endian format

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::append_u16_le

fn append_u16_le(ref self: ByteArray, value: u16)

append_u32

Append a u32 to ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::append_u32

fn append_u32(ref self: ByteArray, value: u32)

append_u32_le

Append a u32 to ByteArray in little-endian format

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::append_u32_le

fn append_u32_le(ref self: ByteArray, value: u32)

append_usize

Append a usize to ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::append_usize

fn append_usize(ref self: ByteArray, value: u32)

append_u64

Append a u64 to ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::append_u64

fn append_u64(ref self: ByteArray, value: u64)

append_u64_le

Append a u64 to ByteArray in little-endian format

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::append_u64_le

fn append_u64_le(ref self: ByteArray, value: u64)

append_u128

Append a u128 to ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::append_u128

fn append_u128(ref self: ByteArray, value: u128)

append_u128_le

Append a u128 to ByteArray in little-endian format

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::append_u128_le

fn append_u128_le(ref self: ByteArray, value: u128)

append_u256

Append a u256 to ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::append_u256

fn append_u256(ref self: ByteArray, value: u256)

append_u256_le

Append a u256 to ByteArray in little-endian format

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::append_u256_le

fn append_u256_le(ref self: ByteArray, value: u256)

append_u512

Append a u512 to ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::append_u512

fn append_u512(ref self: ByteArray, value: u512)

append_felt252

Append a felt252 to ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::append_felt252

fn append_felt252(ref self: ByteArray, value: felt252)

append_bytes_le

Append bytes data of size count ordered in little endian

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::append_bytes_le

fn append_bytes_le(ref self: ByteArray, bytes: felt252, count: u32)

append_address

Append a ContractAddress to ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::append_address

fn append_address(ref self: ByteArray, value: ContractAddress)

append_bytes31

Append a bytes31 to ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::append_bytes31

fn append_bytes31(ref self: ByteArray, value: bytes31)

update_at

Update a byte at a specific offset in ByteArray

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::update_at

fn update_at(ref self: ByteArray, offset: u32, value: u8)

keccak_be

Computes the keccak256 hash of the ByteArray in big-endian format

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::keccak_be

fn keccak_be(self: @ByteArray) -> u256

keccak_le

Computes the keccak256 hash of the ByteArray in little-endian format

Fully qualified path: alexandria_bytes::byte_array_ext::ByteArrayTraitExtImpl::keccak_le

fn keccak_le(self: @ByteArray) -> u256