Implement Deref and DerefMut for In (#11104)

# Objective

Implement Deref and DerefMut for In<T>

makes it so the user doesn't have to add ".0" in most cases
This commit is contained in:
Adam 2024-01-01 08:55:07 -08:00 committed by GitHub
parent 2fd0043cfd
commit 8baefa1570
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -308,6 +308,20 @@ pub fn assert_system_does_not_conflict<Out, Params, S: IntoSystem<(), Out, Param
system.run((), &mut world);
}
impl<T> std::ops::Deref for In<T> {
type Target = T;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl<T> std::ops::DerefMut for In<T> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
#[cfg(test)]
mod tests {
use std::any::TypeId;