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:
parent
2fd0043cfd
commit
8baefa1570
@ -308,6 +308,20 @@ pub fn assert_system_does_not_conflict<Out, Params, S: IntoSystem<(), Out, Param
|
|||||||
system.run((), &mut world);
|
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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::any::TypeId;
|
use std::any::TypeId;
|
||||||
|
Loading…
Reference in New Issue
Block a user