Make const the states when able.

This commit is contained in:
Dario Nieuwenhuis 2021-08-02 19:50:07 +02:00
parent 63ac7ac799
commit e238079d7d
2 changed files with 2 additions and 2 deletions

View File

@ -17,7 +17,7 @@ pub trait PeripheralState: Send {
pub struct StateStorage<S>(MaybeUninit<S>); pub struct StateStorage<S>(MaybeUninit<S>);
impl<S> StateStorage<S> { impl<S> StateStorage<S> {
pub fn new() -> Self { pub const fn new() -> Self {
Self(MaybeUninit::uninit()) Self(MaybeUninit::uninit())
} }
} }

View File

@ -20,7 +20,7 @@ use descriptors::DescriptorRing;
pub struct State<'d, const TX: usize, const RX: usize>(StateStorage<Inner<'d, TX, RX>>); pub struct State<'d, const TX: usize, const RX: usize>(StateStorage<Inner<'d, TX, RX>>);
impl<'d, const TX: usize, const RX: usize> State<'d, TX, RX> { impl<'d, const TX: usize, const RX: usize> State<'d, TX, RX> {
pub fn new() -> Self { pub const fn new() -> Self {
Self(StateStorage::new()) Self(StateStorage::new())
} }
} }