Derive Macro bevy::prelude::DerefMut

#[derive(DerefMut)]
Expand description

Implements DerefMut for single-item structs. This is especially useful when utilizing the newtype pattern.

DerefMut requires a Deref implementation. You can implement it manually or use Bevy’s derive macro for convenience.

Example

use bevy_derive::{Deref, DerefMut};

#[derive(Deref, DerefMut)]
struct MyNewtype(String);

let mut foo = MyNewtype(String::from("Hello"));
foo.push_str(" World!");
assert_eq!("Hello World!", *foo);