Skip to content

Commit

Permalink
Implement Borrow<T> for Handle<T>
Browse files Browse the repository at this point in the history
This makes `Handle` more useful in some generic code, and I'm about to
make use of that.
  • Loading branch information
hannobraun committed Aug 2, 2023
1 parent 9b1fcde commit 9354257
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/fj-core/src/storage/handle.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use std::{any::type_name, cmp::Ordering, fmt, hash::Hash, ops::Deref};
use std::{
any::type_name, borrow::Borrow, cmp::Ordering, fmt, hash::Hash, ops::Deref,
};

use super::{blocks::Index, store::StoreInner};

Expand Down Expand Up @@ -82,6 +84,12 @@ impl<T> Deref for Handle<T> {
}
}

impl<T> Borrow<T> for Handle<T> {
fn borrow(&self) -> &T {
self.deref()
}
}

impl<T> Clone for Handle<T> {
fn clone(&self) -> Self {
Self {
Expand Down

0 comments on commit 9354257

Please sign in to comment.