xwt_anchor/impls/core/
as.rs

1//! [`AsRef`] and [`AsMut`].
2
3use crate::types::*;
4
5/// Implement all traits for a given type.
6macro_rules! implement {
7    (
8        $($t:ty,)*
9    ) => {
10        $(
11            impl<T> AsRef<T> for $t {
12                fn as_ref(&self) -> &T {
13                    &self.0
14                }
15            }
16
17            impl<T> AsMut<T> for $t {
18                fn as_mut(&mut self) -> &mut T {
19                    &mut self.0
20                }
21            }
22        )*
23    };
24}
25
26crate::for_all_material_types!(implement);