> Aztec.nr API reference, v6.0.0 (mainnet and testnet). Index: https://docs.aztec.network/aztec-nr-api/v6.0.0/llms.txt

# Struct ScheduledDelayChange

Module: `noir_aztec::protocol::delayed_public_mutable::scheduled_delay_change`

```rust
pub struct ScheduledDelayChange<let INITIAL_DELAY: u64>
{ /* private fields */ }
```

## Implementations

```rust
impl<let INITIAL_DELAY: u64> ScheduledDelayChange<INITIAL_DELAY>
```

```rust
pub fn new(pre: Option<u64>, post: Option<u64>, timestamp_of_change: u64) -> Self
```

```rust
pub fn get_current(self, current_timestamp: u64) -> u64
```

Returns the current value of the delay stored in the data structure. WARNING: This function only returns a meaningful value when called in public with the current timestamp - for historical private reads use `get_effective_minimum_delay_at` instead.

```rust
pub fn get_scheduled(self) -> (u64, u64)
```

Returns the scheduled change, i.e. the post-change delay and the timestamp at which it will become the current delay. Note that this timestamp may be in the past if the change has already taken place. Additionally, further changes might be later scheduled, potentially canceling the one returned by this function.

```rust
pub fn schedule_change(&mut self, new: u64, current_timestamp: u64)
```

Schedules a change to the delay, given the `current_timestamp` and the `current` delay. This function is only meaningful when called in public with the current timestamp. The timestamp at which the new delay will become effective is determined automatically:

- when increasing the delay, the change is effective immediately
- when reducing the delay, the change will take effect after a delay equal to the difference between old and new delay. For example, if reducing from 3 days to 1 day, the reduction will be scheduled to happen after 2 days.

```rust
pub fn get_effective_minimum_delay_at(self, anchor_block_timestamp: u64) -> u64
```

Returns the minimum delay before a value might mutate due to a scheduled change, from the perspective of some anchor block timestamp. It only returns a meaningful value when called in private with anchor block timestamps. The output of this function can be passed into `ScheduledValueChange.get_time_horizon` to properly constrain the `expiration_timestamp` when reading delayed mutable state. This value typically equals the current delay at the timestamp following the anchor block one (the earliest one in which a value change could be scheduled), but it also considers scenarios in which a delay reduction is scheduled to happen in the near future, resulting in a way to schedule a change with an overall delay lower than the current one.

Alternative explanation: returns the maximum amount of time (from the anchor block timestamp) that a state read (as at the anchor block timestamp) will remain valid. A read might end up being valid for less time in the case where a `svc.timestamp_of_change` has already been set and if it's sooner than the output of this function. In that case, the `scheduled_value_change.nr`'s `get_time_horizon` function will realize this.

## Trait implementations

```rust
impl<let INITIAL_DELAY: u64> Empty for ScheduledDelayChange<INITIAL_DELAY>
```

```rust
pub fn empty() -> Self
```

```rust
pub fn is_empty(self: Self) -> bool
where
    Self: Eq
```

```rust
pub fn assert_empty<let S: u32>(self: Self, msg: str<S>)
where
    Self: Eq
```

```rust
impl<let INITIAL_DELAY: u64> Eq for ScheduledDelayChange<INITIAL_DELAY>
```

```rust
pub fn eq(self, other: Self) -> bool
```
