1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#[derive(Copy, Clone, Debug)] pub struct Payload<T: PartialEq> { pub cargo: T, pub taken_from: Option<usize>, // TODO: Make pub(crate) and allow consructing from T } impl<T: PartialEq> Payload<T> { pub fn new(cargo: T) -> Payload<T> { Payload { cargo, taken_from: None, } } } impl<T: PartialEq> PartialEq for Payload<T> { fn eq(&self, other: &Payload<T>) -> bool { self.cargo == other.cargo } }