pub fn read_slice_quads(slot: b256) -> Option<raw_slice> 
Expand description

Loads a raw_slice from storage, stored in slots of 32 bytes, starting at the slot.

Additional Information

Loading does not distinguish between a slot that has never been written to
and a slot that contains a slice of length zero. In both cases, None is returned.

Arguments

  • slot: [b256] - The storage slot to begin loading a slice from.

Returns

  • [Option<raw_slice>] - If no value was previously stored at slot, or the stored slice was empty, None is returned. Otherwise,
    Some(value) is returned, where value is the raw_slice stored at slot.

Number of Storage Accesses

  • Reads: 2 (one for the length of the slice, and one for the slice content)

Examples

use std::{alloc::alloc_bytes, storage::{write_slice_quads, read_slice_quads}};

fn foo {
    let slice = asm(ptr: (alloc_bytes(1), 1)) { ptr: raw_slice };
    assert(read_slice_quads(b256::zero()).is_none());
    write_slice_quads(b256::zero(), slice);
    let stored_slice = read_slice_quads(b256::zero()).unwrap();
    assert_eq(slice, stored_slice);
}