Skip to content

Commit

Permalink
remove impl Clone, and use derve(Clone) instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Arikato111 committed Jun 16, 2024
1 parent 749e51b commit 42d8f44
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 36 deletions.
22 changes: 2 additions & 20 deletions src/openflow/ofp10/events/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub enum ActionType {
Enqueue = 11,
}

#[derive(Clone)]
pub enum Action {
Oputput(PseudoPort),
SetDlVlan(Option<u16>),
Expand Down Expand Up @@ -239,23 +240,4 @@ impl SizeCheck for Vec<Action> {
not_ctrl.append(&mut is_ctrl);
not_ctrl
}
}

impl Clone for Action {
fn clone(&self) -> Self {
match self {
Self::Oputput(v) => Self::Oputput(v.clone()),
Self::SetDlVlan(v) => Self::SetDlVlan(v.clone()),
Self::SetDlVlanPcp(v) => Self::SetDlVlanPcp(v.clone()),
Self::SetDlSrc(v) => Self::SetDlSrc(v.clone()),
Self::SetDlDest(v) => Self::SetDlDest(v.clone()),
Self::SetIpSrc(v) => Self::SetIpSrc(v.clone()),
Self::SetIpDes(v) => Self::SetIpDes(v.clone()),
Self::SetTos(v) => Self::SetTos(v.clone()),
Self::SetTpSrc(v) => Self::SetTpSrc(v.clone()),
Self::SetTpDest(v) => Self::SetTpDest(v.clone()),
Self::Enqueue(v, arg1) => Self::Enqueue(v.clone(), arg1.clone()),
Self::Unparsable => Self::Unparsable,
}
}
}
}
17 changes: 1 addition & 16 deletions src/openflow/ofp10/ofp_port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub enum OfpPort {
None = 0xffff,
}

#[derive(Clone)]
pub enum PseudoPort {
PhysicalPort(u16),
InPort,
Expand Down Expand Up @@ -68,19 +69,3 @@ impl PseudoPort {
let _ = bytes.write_u16::<BigEndian>(port);
}
}

impl Clone for PseudoPort {
fn clone(&self) -> Self {
match self {
Self::PhysicalPort(arg0) => Self::PhysicalPort(arg0.clone()),
Self::InPort => Self::InPort,
Self::Table => Self::Table,
Self::Normal => Self::Normal,
Self::Flood => Self::Flood,
Self::AllPorts => Self::AllPorts,
Self::Controller(arg0) => Self::Controller(arg0.clone()),
Self::Local => Self::Local,
Self::Unsupport => Self::Unsupport,
}
}
}

0 comments on commit 42d8f44

Please sign in to comment.