In rust this would simply be
enum ConnectionStste { Connected(u32), Disconnected }
or
struct Connected { peer_ip: u32 } struct Disconnected; struct Connection<State> { state: State }
or