SolBytesTrait
Solidity Bytes Trait meant to provide an interface similar to Solidity's bytesX types, like bytes1
, bytes2
, bytes3
, ..., bytes32
. Acts as a wrapper around the encode_as
to make it easier to understand and use. Use like this: let bytes7Val: Bytes = SolBytesTrait::bytes7(0x01020304050607_u128);
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait
#![allow(unused)] fn main() { pub trait SolBytesTrait<T> }
Trait functions
bytes1
Creates 1-byte representation of a value
Arguments
val
- The value to encode as 1 byte
Returns
Bytes
- 1-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes1
#![allow(unused)] fn main() { fn bytes1(val: T) -> Bytes }
bytes2
Creates 2-byte representation of a value
Arguments
val
- The value to encode as 2 bytes
Returns
Bytes
- 2-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes2
#![allow(unused)] fn main() { fn bytes2(val: T) -> Bytes }
bytes3
Creates 3-byte representation of a value
Arguments
val
- The value to encode as 3 bytes
Returns
Bytes
- 3-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes3
#![allow(unused)] fn main() { fn bytes3(val: T) -> Bytes }
bytes4
Creates 4-byte representation of a value
Arguments
val
- The value to encode as 4 bytes
Returns
Bytes
- 4-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes4
#![allow(unused)] fn main() { fn bytes4(val: T) -> Bytes }
bytes5
Creates 5-byte representation of a value
Arguments
val
- The value to encode as 5 bytes
Returns
Bytes
- 5-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes5
#![allow(unused)] fn main() { fn bytes5(val: T) -> Bytes }
bytes6
Creates 6-byte representation of a value
Arguments
val
- The value to encode as 6 bytes
Returns
Bytes
- 6-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes6
#![allow(unused)] fn main() { fn bytes6(val: T) -> Bytes }
bytes7
Creates 7-byte representation of a value
Arguments
val
- The value to encode as 7 bytes
Returns
Bytes
- 7-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes7
#![allow(unused)] fn main() { fn bytes7(val: T) -> Bytes }
bytes8
Creates 8-byte representation of a value
Arguments
val
- The value to encode as 8 bytes
Returns
Bytes
- 8-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes8
#![allow(unused)] fn main() { fn bytes8(val: T) -> Bytes }
bytes9
Creates 9-byte representation of a value
Arguments
val
- The value to encode as 9 bytes
Returns
Bytes
- 9-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes9
#![allow(unused)] fn main() { fn bytes9(val: T) -> Bytes }
bytes10
Creates 10-byte representation of a value
Arguments
val
- The value to encode as 10 bytes
Returns
Bytes
- 10-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes10
#![allow(unused)] fn main() { fn bytes10(val: T) -> Bytes }
bytes11
Creates 11-byte representation of a value
Arguments
val
- The value to encode as 11 bytes
Returns
Bytes
- 11-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes11
#![allow(unused)] fn main() { fn bytes11(val: T) -> Bytes }
bytes12
Creates 12-byte representation of a value
Arguments
val
- The value to encode as 12 bytes
Returns
Bytes
- 12-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes12
#![allow(unused)] fn main() { fn bytes12(val: T) -> Bytes }
bytes13
Creates 13-byte representation of a value
Arguments
val
- The value to encode as 13 bytes
Returns
Bytes
- 13-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes13
#![allow(unused)] fn main() { fn bytes13(val: T) -> Bytes }
bytes14
Creates 14-byte representation of a value
Arguments
val
- The value to encode as 14 bytes
Returns
Bytes
- 14-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes14
#![allow(unused)] fn main() { fn bytes14(val: T) -> Bytes }
bytes15
Creates 15-byte representation of a value
Arguments
val
- The value to encode as 15 bytes
Returns
Bytes
- 15-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes15
#![allow(unused)] fn main() { fn bytes15(val: T) -> Bytes }
bytes16
Creates 16-byte representation of a value
Arguments
val
- The value to encode as 16 bytes
Returns
Bytes
- 16-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes16
#![allow(unused)] fn main() { fn bytes16(val: T) -> Bytes }
bytes17
Creates 17-byte representation of a value
Arguments
val
- The value to encode as 17 bytes
Returns
Bytes
- 17-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes17
#![allow(unused)] fn main() { fn bytes17(val: T) -> Bytes }
bytes18
Creates 18-byte representation of a value
Arguments
val
- The value to encode as 18 bytes
Returns
Bytes
- 18-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes18
#![allow(unused)] fn main() { fn bytes18(val: T) -> Bytes }
bytes19
Creates 19-byte representation of a value
Arguments
val
- The value to encode as 19 bytes
Returns
Bytes
- 19-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes19
#![allow(unused)] fn main() { fn bytes19(val: T) -> Bytes }
bytes20
Creates 20-byte representation of a value
Arguments
val
- The value to encode as 20 bytes
Returns
Bytes
- 20-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes20
#![allow(unused)] fn main() { fn bytes20(val: T) -> Bytes }
bytes21
Creates 21-byte representation of a value
Arguments
val
- The value to encode as 21 bytes
Returns
Bytes
- 21-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes21
#![allow(unused)] fn main() { fn bytes21(val: T) -> Bytes }
bytes22
Creates 22-byte representation of a value
Arguments
val
- The value to encode as 22 bytes
Returns
Bytes
- 22-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes22
#![allow(unused)] fn main() { fn bytes22(val: T) -> Bytes }
bytes23
Creates 23-byte representation of a value
Arguments
val
- The value to encode as 23 bytes
Returns
Bytes
- 23-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes23
#![allow(unused)] fn main() { fn bytes23(val: T) -> Bytes }
bytes24
Creates 24-byte representation of a value
Arguments
val
- The value to encode as 24 bytes
Returns
Bytes
- 24-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes24
#![allow(unused)] fn main() { fn bytes24(val: T) -> Bytes }
bytes25
Creates 25-byte representation of a value
Arguments
val
- The value to encode as 25 bytes
Returns
Bytes
- 25-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes25
#![allow(unused)] fn main() { fn bytes25(val: T) -> Bytes }
bytes26
Creates 26-byte representation of a value
Arguments
val
- The value to encode as 26 bytes
Returns
Bytes
- 26-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes26
#![allow(unused)] fn main() { fn bytes26(val: T) -> Bytes }
bytes27
Creates 27-byte representation of a value
Arguments
val
- The value to encode as 27 bytes
Returns
Bytes
- 27-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes27
#![allow(unused)] fn main() { fn bytes27(val: T) -> Bytes }
bytes28
Creates 28-byte representation of a value
Arguments
val
- The value to encode as 28 bytes
Returns
Bytes
- 28-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes28
#![allow(unused)] fn main() { fn bytes28(val: T) -> Bytes }
bytes29
Creates 29-byte representation of a value
Arguments
val
- The value to encode as 29 bytes
Returns
Bytes
- 29-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes29
#![allow(unused)] fn main() { fn bytes29(val: T) -> Bytes }
bytes30
Creates 30-byte representation of a value
Arguments
val
- The value to encode as 30 bytes
Returns
Bytes
- 30-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes30
#![allow(unused)] fn main() { fn bytes30(val: T) -> Bytes }
bytes31
Creates 31-byte representation of a value
Arguments
val
- The value to encode as 31 bytes
Returns
Bytes
- 31-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes31
#![allow(unused)] fn main() { fn bytes31(val: T) -> Bytes }
bytes32
Creates 32-byte representation of a value
Arguments
val
- The value to encode as 32 bytes
Returns
Bytes
- 32-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes32
#![allow(unused)] fn main() { fn bytes32(val: T) -> Bytes }
bytes
Creates n-byte representation of a value
Arguments
len
- The number of bytes to use for encodingval
- The value to encode
Returns
Bytes
- n-byte encoded representation
Fully qualified path: alexandria_encoding::sol_abi::sol_bytes::SolBytesTrait::bytes
#![allow(unused)] fn main() { fn bytes(len: usize, val: T) -> Bytes }