pub enum PlanetToOrchestrator {
SunrayAck {
planet_id: ID,
},
AsteroidAck {
planet_id: ID,
rocket: Option<Rocket>,
},
StartPlanetAIResult {
planet_id: ID,
},
StopPlanetAIResult {
planet_id: ID,
},
KillPlanetResult {
planet_id: ID,
},
InternalStateResponse {
planet_id: ID,
planet_state: DummyPlanetState,
},
IncomingExplorerResponse {
planet_id: ID,
explorer_id: ID,
res: Result<(), String>,
},
OutgoingExplorerResponse {
planet_id: ID,
explorer_id: ID,
res: Result<(), String>,
},
Stopped {
planet_id: ID,
},
}Expand description
This enum describes all possible messages from a Planet to the Orchestrator
Variants§
SunrayAck
This variant is used to acknowledge the obtained Sunray
Response to: OrchestratorToPlanet::Sunray
AsteroidAck
This variant is used to acknowledge the obtained Asteroid and notify the orchestrator if the planet has a rocket to defend itself
Response to: OrchestratorToPlanet::Asteroid
Fields
StartPlanetAIResult
This variant is used to acknowledge the starting of the Planet Ai
Response to: OrchestratorToPlanet::StartPlanetAI
StopPlanetAIResult
This variant is used to acknowledge the stopping of the Planet Ai, in this state a planet will only respond
to incoming messages with a PlanetToOrchestrator::Stopped
Response to: OrchestratorToPlanet::StopPlanetAI
KillPlanetResult
This variant is used to acknowledge the killing of a planet, in this case the planet thread will be terminated and the planet will be deleted from the galaxy
Response to: OrchestratorToPlanet::KillPlanet
InternalStateResponse
This variant is used to send back the Planet State
Response to OrchestratorToPlanet::InternalStateRequest
Fields
planet_state: DummyPlanetStateA struct containing the relevant information of a Planet to be shown by the GUI
IncomingExplorerResponse
This variant is used to acknowledge the incoming explorer reception
Response to OrchestratorToPlanet::IncomingExplorerRequest
Fields
OutgoingExplorerResponse
This variant is used to acknowledge that an explorer is leaving the planet
Response to: OrchestratorToPlanet::OutgoingExplorerRequest
Fields
Stopped
This variant is used by planets that are currently in a stopped state
to acknowledge any message coming from the Orchestrator (except for OrchestratorToPlanet::StartPlanetAI)
Implementations§
Source§impl PlanetToOrchestrator
impl PlanetToOrchestrator
Sourcepub fn is_sunray_ack(&self) -> bool
pub fn is_sunray_ack(&self) -> bool
Returns true if this is a PlanetToOrchestrator::SunrayAck, otherwise false
Sourcepub fn as_sunray_ack_mut(&mut self) -> Option<&mut ID>
pub fn as_sunray_ack_mut(&mut self) -> Option<&mut ID>
Optionally returns mutable references to the inner fields if this is a PlanetToOrchestrator::SunrayAck, otherwise None
Sourcepub fn as_sunray_ack(&self) -> Option<&ID>
pub fn as_sunray_ack(&self) -> Option<&ID>
Optionally returns references to the inner fields if this is a PlanetToOrchestrator::SunrayAck, otherwise None
Sourcepub fn into_sunray_ack(self) -> Result<ID, Self>
pub fn into_sunray_ack(self) -> Result<ID, Self>
Returns the inner fields if this is a PlanetToOrchestrator::SunrayAck, otherwise returns back the enum in the Err case of the result
Sourcepub fn is_asteroid_ack(&self) -> bool
pub fn is_asteroid_ack(&self) -> bool
Returns true if this is a PlanetToOrchestrator::AsteroidAck, otherwise false
Sourcepub fn as_asteroid_ack_mut(&mut self) -> Option<(&mut ID, &mut Option<Rocket>)>
pub fn as_asteroid_ack_mut(&mut self) -> Option<(&mut ID, &mut Option<Rocket>)>
Optionally returns mutable references to the inner fields if this is a PlanetToOrchestrator::AsteroidAck, otherwise None
Sourcepub fn as_asteroid_ack(&self) -> Option<(&ID, &Option<Rocket>)>
pub fn as_asteroid_ack(&self) -> Option<(&ID, &Option<Rocket>)>
Optionally returns references to the inner fields if this is a PlanetToOrchestrator::AsteroidAck, otherwise None
Sourcepub fn into_asteroid_ack(self) -> Result<(ID, Option<Rocket>), Self>
pub fn into_asteroid_ack(self) -> Result<(ID, Option<Rocket>), Self>
Returns the inner fields if this is a PlanetToOrchestrator::AsteroidAck, otherwise returns back the enum in the Err case of the result
Sourcepub fn is_start_planet_ai_result(&self) -> bool
pub fn is_start_planet_ai_result(&self) -> bool
Returns true if this is a PlanetToOrchestrator::StartPlanetAIResult, otherwise false
Sourcepub fn as_start_planet_ai_result_mut(&mut self) -> Option<&mut ID>
pub fn as_start_planet_ai_result_mut(&mut self) -> Option<&mut ID>
Optionally returns mutable references to the inner fields if this is a PlanetToOrchestrator::StartPlanetAIResult, otherwise None
Sourcepub fn as_start_planet_ai_result(&self) -> Option<&ID>
pub fn as_start_planet_ai_result(&self) -> Option<&ID>
Optionally returns references to the inner fields if this is a PlanetToOrchestrator::StartPlanetAIResult, otherwise None
Sourcepub fn into_start_planet_ai_result(self) -> Result<ID, Self>
pub fn into_start_planet_ai_result(self) -> Result<ID, Self>
Returns the inner fields if this is a PlanetToOrchestrator::StartPlanetAIResult, otherwise returns back the enum in the Err case of the result
Sourcepub fn is_stop_planet_ai_result(&self) -> bool
pub fn is_stop_planet_ai_result(&self) -> bool
Returns true if this is a PlanetToOrchestrator::StopPlanetAIResult, otherwise false
Sourcepub fn as_stop_planet_ai_result_mut(&mut self) -> Option<&mut ID>
pub fn as_stop_planet_ai_result_mut(&mut self) -> Option<&mut ID>
Optionally returns mutable references to the inner fields if this is a PlanetToOrchestrator::StopPlanetAIResult, otherwise None
Sourcepub fn as_stop_planet_ai_result(&self) -> Option<&ID>
pub fn as_stop_planet_ai_result(&self) -> Option<&ID>
Optionally returns references to the inner fields if this is a PlanetToOrchestrator::StopPlanetAIResult, otherwise None
Sourcepub fn into_stop_planet_ai_result(self) -> Result<ID, Self>
pub fn into_stop_planet_ai_result(self) -> Result<ID, Self>
Returns the inner fields if this is a PlanetToOrchestrator::StopPlanetAIResult, otherwise returns back the enum in the Err case of the result
Sourcepub fn is_kill_planet_result(&self) -> bool
pub fn is_kill_planet_result(&self) -> bool
Returns true if this is a PlanetToOrchestrator::KillPlanetResult, otherwise false
Sourcepub fn as_kill_planet_result_mut(&mut self) -> Option<&mut ID>
pub fn as_kill_planet_result_mut(&mut self) -> Option<&mut ID>
Optionally returns mutable references to the inner fields if this is a PlanetToOrchestrator::KillPlanetResult, otherwise None
Sourcepub fn as_kill_planet_result(&self) -> Option<&ID>
pub fn as_kill_planet_result(&self) -> Option<&ID>
Optionally returns references to the inner fields if this is a PlanetToOrchestrator::KillPlanetResult, otherwise None
Sourcepub fn into_kill_planet_result(self) -> Result<ID, Self>
pub fn into_kill_planet_result(self) -> Result<ID, Self>
Returns the inner fields if this is a PlanetToOrchestrator::KillPlanetResult, otherwise returns back the enum in the Err case of the result
Sourcepub fn is_internal_state_response(&self) -> bool
pub fn is_internal_state_response(&self) -> bool
Returns true if this is a PlanetToOrchestrator::InternalStateResponse, otherwise false
Sourcepub fn as_internal_state_response_mut(
&mut self,
) -> Option<(&mut ID, &mut DummyPlanetState)>
pub fn as_internal_state_response_mut( &mut self, ) -> Option<(&mut ID, &mut DummyPlanetState)>
Optionally returns mutable references to the inner fields if this is a PlanetToOrchestrator::InternalStateResponse, otherwise None
Sourcepub fn as_internal_state_response(&self) -> Option<(&ID, &DummyPlanetState)>
pub fn as_internal_state_response(&self) -> Option<(&ID, &DummyPlanetState)>
Optionally returns references to the inner fields if this is a PlanetToOrchestrator::InternalStateResponse, otherwise None
Sourcepub fn into_internal_state_response(
self,
) -> Result<(ID, DummyPlanetState), Self>
pub fn into_internal_state_response( self, ) -> Result<(ID, DummyPlanetState), Self>
Returns the inner fields if this is a PlanetToOrchestrator::InternalStateResponse, otherwise returns back the enum in the Err case of the result
Sourcepub fn is_incoming_explorer_response(&self) -> bool
pub fn is_incoming_explorer_response(&self) -> bool
Returns true if this is a PlanetToOrchestrator::IncomingExplorerResponse, otherwise false
Sourcepub fn as_incoming_explorer_response_mut(
&mut self,
) -> Option<(&mut ID, &mut ID, &mut Result<(), String>)>
pub fn as_incoming_explorer_response_mut( &mut self, ) -> Option<(&mut ID, &mut ID, &mut Result<(), String>)>
Optionally returns mutable references to the inner fields if this is a PlanetToOrchestrator::IncomingExplorerResponse, otherwise None
Sourcepub fn as_incoming_explorer_response(
&self,
) -> Option<(&ID, &ID, &Result<(), String>)>
pub fn as_incoming_explorer_response( &self, ) -> Option<(&ID, &ID, &Result<(), String>)>
Optionally returns references to the inner fields if this is a PlanetToOrchestrator::IncomingExplorerResponse, otherwise None
Sourcepub fn into_incoming_explorer_response(
self,
) -> Result<(ID, ID, Result<(), String>), Self>
pub fn into_incoming_explorer_response( self, ) -> Result<(ID, ID, Result<(), String>), Self>
Returns the inner fields if this is a PlanetToOrchestrator::IncomingExplorerResponse, otherwise returns back the enum in the Err case of the result
Sourcepub fn is_outgoing_explorer_response(&self) -> bool
pub fn is_outgoing_explorer_response(&self) -> bool
Returns true if this is a PlanetToOrchestrator::OutgoingExplorerResponse, otherwise false
Sourcepub fn as_outgoing_explorer_response_mut(
&mut self,
) -> Option<(&mut ID, &mut ID, &mut Result<(), String>)>
pub fn as_outgoing_explorer_response_mut( &mut self, ) -> Option<(&mut ID, &mut ID, &mut Result<(), String>)>
Optionally returns mutable references to the inner fields if this is a PlanetToOrchestrator::OutgoingExplorerResponse, otherwise None
Sourcepub fn as_outgoing_explorer_response(
&self,
) -> Option<(&ID, &ID, &Result<(), String>)>
pub fn as_outgoing_explorer_response( &self, ) -> Option<(&ID, &ID, &Result<(), String>)>
Optionally returns references to the inner fields if this is a PlanetToOrchestrator::OutgoingExplorerResponse, otherwise None
Sourcepub fn into_outgoing_explorer_response(
self,
) -> Result<(ID, ID, Result<(), String>), Self>
pub fn into_outgoing_explorer_response( self, ) -> Result<(ID, ID, Result<(), String>), Self>
Returns the inner fields if this is a PlanetToOrchestrator::OutgoingExplorerResponse, otherwise returns back the enum in the Err case of the result
Sourcepub fn is_stopped(&self) -> bool
pub fn is_stopped(&self) -> bool
Returns true if this is a PlanetToOrchestrator::Stopped, otherwise false
Sourcepub fn as_stopped_mut(&mut self) -> Option<&mut ID>
pub fn as_stopped_mut(&mut self) -> Option<&mut ID>
Optionally returns mutable references to the inner fields if this is a PlanetToOrchestrator::Stopped, otherwise None
Sourcepub fn as_stopped(&self) -> Option<&ID>
pub fn as_stopped(&self) -> Option<&ID>
Optionally returns references to the inner fields if this is a PlanetToOrchestrator::Stopped, otherwise None
Sourcepub fn into_stopped(self) -> Result<ID, Self>
pub fn into_stopped(self) -> Result<ID, Self>
Returns the inner fields if this is a PlanetToOrchestrator::Stopped, otherwise returns back the enum in the Err case of the result