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

# Struct MaybeNoteMessage

Module: `noir_aztec::note`

```rust
pub struct MaybeNoteMessage<Note>
{ /* private fields */ }
```

Same as [`NoteMessage`](/aztec-nr-api/mainnet/noir_aztec/note/struct.NoteMessage.md), except this type also handles the possibility where the note may not have been actually created depending on runtime conditions (e.g. a token transfer change note is not created if there is no change).

Other than that, it and [`MaybeNoteMessage::deliver`](/aztec-nr-api/mainnet/noir_aztec/note/struct.MaybeNoteMessage.md#deliver) behave the exact same way as [`NoteMessage`](/aztec-nr-api/mainnet/noir_aztec/note/struct.NoteMessage.md).

## Implementations

```rust
impl<Note> MaybeNoteMessage<Note>
where
    Note: NoteType,
    Note: Packable<N = _>
```

```rust
pub fn new(maybe_new_note: Option<NewNote<Note>>, context: &mut PrivateContext) -> Self
where
    Note: Packable
```

```rust
pub fn deliver<D>(self, delivery_mode: D)
where
    D: MessageDeliveryBuilder,
    Note: Packable
```

Same as [`NoteMessage::deliver`](/aztec-nr-api/mainnet/noir_aztec/note/struct.NoteMessage.md#deliver), except the message will only be delivered if it actually exists.

Messages delivered using \[`crate::messages::delivery::MessageDelivery::onchain_constrained()`] will pay proving costs regardless of whether the message exists or not.

```rust
pub fn deliver_to<D>(self, recipient: AztecAddress, delivery_mode: D)
where
    D: MessageDeliveryBuilder,
    Note: Packable
```

Same as [`NoteMessage::deliver_to`](/aztec-nr-api/mainnet/noir_aztec/note/struct.NoteMessage.md#deliver_to), except the message will only be delivered if it actually exists.

Messages delivered using \[`crate::messages::delivery::MessageDelivery::onchain_constrained()`] will pay proving costs regardless of whether the message exists or not.

```rust
pub fn get_note(self) -> Option<Note>
where
    Note: Packable
```

Returns the note contained in the message.
