Implement Borrow/BorrowMut/ToOwned relationships betweed IdxSetBuf and IdxSet.
This commit is contained in:
parent
39e126c001
commit
e437e499d1
1 changed files with 20 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::borrow::{Borrow, BorrowMut, ToOwned};
|
||||
use std::fmt;
|
||||
use std::iter;
|
||||
use std::marker::PhantomData;
|
||||
|
@ -73,6 +74,25 @@ pub struct IdxSet<T: Idx> {
|
|||
bits: [Word],
|
||||
}
|
||||
|
||||
impl<T: Idx> Borrow<IdxSet<T>> for IdxSetBuf<T> {
|
||||
fn borrow(&self) -> &IdxSet<T> {
|
||||
&*self
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Idx> BorrowMut<IdxSet<T>> for IdxSetBuf<T> {
|
||||
fn borrow_mut(&mut self) -> &mut IdxSet<T> {
|
||||
&mut *self
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Idx> ToOwned for IdxSet<T> {
|
||||
type Owned = IdxSetBuf<T>;
|
||||
fn to_owned(&self) -> Self::Owned {
|
||||
IdxSet::to_owned(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Idx> fmt::Debug for IdxSetBuf<T> {
|
||||
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
|
||||
w.debug_list()
|
||||
|
|
Loading…
Add table
Reference in a new issue