chiark / gitweb /
OE
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 4 Jul 2020 02:03:49 +0000 (03:03 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 4 Jul 2020 02:03:49 +0000 (03:03 +0100)
src/error.rs

index 2fe93f327d180a5a014f78a360be1b6799017cb1..75c8b9ffe6903e3ebc166a28010ffc8349b28d5b 100644 (file)
@@ -25,15 +25,17 @@ impl<X> From<PoisonError<X>> for OnlineError {
 pub trait ById {
   type Id;
   type Entry;
-  #[throws(OE)]
+  type Error;
+  #[throws(Self::Error)]
   fn byid(&self, t: Self::Id) -> &Self::Entry;
-  #[throws(OE)]
+  #[throws(Self::Error)]
   fn byid_mut(&mut self, t: Self::Id) -> &mut Self::Entry;
 }
 
 impl<I:AccessId+slotmap::Key, T> ById for DenseSlotMap<I,T> {
   type Id = I;
   type Entry = T;
+  type Error = OE;
   fn byid(&self, t: Self::Id) -> Result<&Self::Entry, OE> {
     self.get(t).ok_or(<I as AccessId>::ERROR)
   }
@@ -44,6 +46,7 @@ impl<I:AccessId+slotmap::Key, T> ById for DenseSlotMap<I,T> {
 impl<I:AccessId+slotmap::Key, T> ById for SecondarySlotMap<I,T> {
   type Id = I;
   type Entry = T;
+  type Error = OE;
   fn byid(&self, t: Self::Id) -> Result<&Self::Entry, OE> {
     self.get(t).ok_or(<I as AccessId>::ERROR)
   }