mod private
{
use core::fmt;
use core::hash::Hash;
use core::cmp::{ PartialEq, Eq };
pub trait IdentityInterface
where
Self :
'static +
Copy +
Hash +
fmt::Debug +
PartialEq +
Eq
,
{
}
impl< T > IdentityInterface for T
where
T :
'static +
Copy +
Hash +
fmt::Debug +
PartialEq +
Eq
,
{
}
pub trait IdentityGeneratorInterface< Id >
where
Id : IdentityInterface + Default,
{
fn next( &mut self ) -> Id;
fn first( &mut self ) -> Id
{
Default::default()
}
fn id_is_valid( &self, id : Id ) -> bool;
}
pub trait HasId
{
type Id : IdentityInterface;
fn id( &self ) -> Self::Id;
}
}
crate::mod_interface!
{
prelude use super::private::
{
IdentityInterface,
IdentityGeneratorInterface,
HasId,
};
}