No more cast_mut()

This commit is contained in:
2024-07-26 00:37:53 +02:00
parent 6c797820dc
commit 3fd8dddeb2
7 changed files with 29 additions and 39 deletions

View File

@@ -6,7 +6,6 @@ use std::marker::Unsize;
pub trait Cast<P: ?Sized> {
fn cast(&self) -> Option<&P>;
fn cast_mut(&mut self) -> Option<&mut P>;
}
impl<D, P> Cast<P> for D
@@ -16,10 +15,6 @@ where
default fn cast(&self) -> Option<&P> {
None
}
default fn cast_mut(&mut self) -> Option<&mut P> {
None
}
}
impl<D, P> Cast<P> for D
@@ -30,8 +25,4 @@ where
fn cast(&self) -> Option<&P> {
Some(self)
}
fn cast_mut(&mut self) -> Option<&mut P> {
Some(self)
}
}