Macro allocation_id

Source
macro_rules! allocation_id {
    () => { ... };
    ($value:tt) => { ... };
}
Expand description

Converts a sequence of string literals containing hex-encoded data into a new AllocationId at compile time.

To create an AllocationId from a string literal (no 0x prefix) at compile time:

use thegraph_core::{allocation_id, AllocationId};

const ALLOCATION_ID: AllocationId = allocation_id!("0002c67268fb8c8917f36f865a0cbdf5292fa68d");

If no argument is provided, the macro will create an AllocationId with the zero address:

use thegraph_core::{
    alloy::primitives::Address,
    allocation_id, AllocationId
};

const ALLOCATION_ID: AllocationId = allocation_id!();

assert_eq!(ALLOCATION_ID, Address::ZERO);