mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
optimize des more
This commit is contained in:
parent
3dcd6b4ec8
commit
bf71bde27f
4 changed files with 105 additions and 71 deletions
|
@ -104,6 +104,7 @@ impl PeerId {
|
|||
|
||||
#[derive(Encode, Decode, Debug, PartialEq, Eq)]
|
||||
pub enum Destination<PeerType> {
|
||||
Peers(Vec<PeerType>),
|
||||
Peer(PeerType),
|
||||
Host,
|
||||
Broadcast,
|
||||
|
@ -113,9 +114,14 @@ impl<T> Destination<T> {
|
|||
pub fn convert<A>(self) -> Destination<A>
|
||||
where
|
||||
A: From<T>,
|
||||
T: Copy,
|
||||
T: Clone,
|
||||
{
|
||||
match self {
|
||||
Destination::Peer(p) => Destination::Peer(p.into()),
|
||||
Destination::Peers(p) => {
|
||||
Destination::Peers(p.iter().cloned().map(|p| p.into()).collect())
|
||||
}
|
||||
Destination::Host => Destination::Host,
|
||||
Destination::Broadcast => Destination::Broadcast,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue