pub fn clear_quads<T>(slot: b256, offset: u64) -> bool 
Expand description

Clears a value of type T from slots of 32 bytes each, starting at slot with an offset given in words.

Additional Information

If T is a zero-sized type, no storage access will occur. Storage API does not store zero-sized types in storage,
so clearing a zero-sized type from the slot and offset will have no effect.

If T is a zero-sized type, the function always returns true, regardless of the slot and offset.

Arguments

  • slot: [b256] - The storage slot from which to count the offset. This or the following slots can be cleared.
  • offset: [u64] - An offset, in words, from the start of slot, from which the value should be cleared.

Returns

  • [bool] - true if all the cleared storage slots were previously set. Otherwise, false.

Number of Storage Accesses

  • Clears: 1

Examples

use std::storage::storage_api::{read_quads, write_quads, clear_quads};

fn foo() {
    let five = 5_u64;
    write_quads(b256::zero(), 0, five);
    let cleared = clear_quads::<u64>(b256::zero(), 0);
    assert(cleared);
    assert(read_quads::<u64>(b256::zero(), 0).is_none());
}