pub enum PlanetToExplorer {
SupportedResourceResponse {
resource_list: HashSet<BasicResourceType>,
},
SupportedCombinationResponse {
combination_list: HashSet<ComplexResourceType>,
},
GenerateResourceResponse {
resource: Option<BasicResource>,
},
CombineResourceResponse {
complex_response: Result<ComplexResource, (String, GenericResource, GenericResource)>,
},
AvailableEnergyCellResponse {
available_cells: ID,
},
Stopped,
}Expand description
This enum describes all possible messages from a Planet to an Explorer.
Variants§
SupportedResourceResponse
This variant is used to send the available BasicResourceType list to the Explorer
Response To: ExplorerToPlanet::SupportedResourceRequest
Fields
resource_list: HashSet<BasicResourceType>The list of available BasicResourceType
SupportedCombinationResponse
This variant is used to send the available ComplexResourceType list to the Explorer
Response To: ExplorerToPlanet::SupportedCombinationRequest
Fields
combination_list: HashSet<ComplexResourceType>The list of available ComplexResourceType
GenerateResourceResponse
This variant is used to send the generated Basic Resource
Response To: ExplorerToPlanet::GenerateResourceRequest
Fields
resource: Option<BasicResource>The optional Basic Resource generated:
[Some(BasicResource)] if resource has been crafted correctly
None if some error occurred
CombineResourceResponse
This variant is used to send the ComplexResource generated
Response To: ExplorerToPlanet::CombineResourceRequest
Fields
complex_response: Result<ComplexResource, (String, GenericResource, GenericResource)>The complex basic resource generated:
[Ok(ComplexResource)] if complex resource has been crafted correctly
An Err triplet containing an error String and the two resources that were intended to be combined that are given back to the Explorer
AvailableEnergyCellResponse
This variant is used to send the number of available energy cells to the Explorer
Response To: ExplorerToPlanet::AvailableEnergyCellRequest
Stopped
This variant is used by planets that are currently in a stopped state to acknowledge any message coming from an explorer
Implementations§
Source§impl PlanetToExplorer
impl PlanetToExplorer
Sourcepub fn is_supported_resource_response(&self) -> bool
pub fn is_supported_resource_response(&self) -> bool
Returns true if this is a PlanetToExplorer::SupportedResourceResponse, otherwise false
Sourcepub fn as_supported_resource_response_mut(
&mut self,
) -> Option<&mut HashSet<BasicResourceType>>
pub fn as_supported_resource_response_mut( &mut self, ) -> Option<&mut HashSet<BasicResourceType>>
Optionally returns mutable references to the inner fields if this is a PlanetToExplorer::SupportedResourceResponse, otherwise None
Sourcepub fn as_supported_resource_response(
&self,
) -> Option<&HashSet<BasicResourceType>>
pub fn as_supported_resource_response( &self, ) -> Option<&HashSet<BasicResourceType>>
Optionally returns references to the inner fields if this is a PlanetToExplorer::SupportedResourceResponse, otherwise None
Sourcepub fn into_supported_resource_response(
self,
) -> Result<HashSet<BasicResourceType>, Self>
pub fn into_supported_resource_response( self, ) -> Result<HashSet<BasicResourceType>, Self>
Returns the inner fields if this is a PlanetToExplorer::SupportedResourceResponse, otherwise returns back the enum in the Err case of the result
Sourcepub fn is_supported_combination_response(&self) -> bool
pub fn is_supported_combination_response(&self) -> bool
Returns true if this is a PlanetToExplorer::SupportedCombinationResponse, otherwise false
Sourcepub fn as_supported_combination_response_mut(
&mut self,
) -> Option<&mut HashSet<ComplexResourceType>>
pub fn as_supported_combination_response_mut( &mut self, ) -> Option<&mut HashSet<ComplexResourceType>>
Optionally returns mutable references to the inner fields if this is a PlanetToExplorer::SupportedCombinationResponse, otherwise None
Sourcepub fn as_supported_combination_response(
&self,
) -> Option<&HashSet<ComplexResourceType>>
pub fn as_supported_combination_response( &self, ) -> Option<&HashSet<ComplexResourceType>>
Optionally returns references to the inner fields if this is a PlanetToExplorer::SupportedCombinationResponse, otherwise None
Sourcepub fn into_supported_combination_response(
self,
) -> Result<HashSet<ComplexResourceType>, Self>
pub fn into_supported_combination_response( self, ) -> Result<HashSet<ComplexResourceType>, Self>
Returns the inner fields if this is a PlanetToExplorer::SupportedCombinationResponse, otherwise returns back the enum in the Err case of the result
Sourcepub fn is_generate_resource_response(&self) -> bool
pub fn is_generate_resource_response(&self) -> bool
Returns true if this is a PlanetToExplorer::GenerateResourceResponse, otherwise false
Sourcepub fn as_generate_resource_response_mut(
&mut self,
) -> Option<&mut Option<BasicResource>>
pub fn as_generate_resource_response_mut( &mut self, ) -> Option<&mut Option<BasicResource>>
Optionally returns mutable references to the inner fields if this is a PlanetToExplorer::GenerateResourceResponse, otherwise None
Sourcepub fn as_generate_resource_response(&self) -> Option<&Option<BasicResource>>
pub fn as_generate_resource_response(&self) -> Option<&Option<BasicResource>>
Optionally returns references to the inner fields if this is a PlanetToExplorer::GenerateResourceResponse, otherwise None
Sourcepub fn into_generate_resource_response(
self,
) -> Result<Option<BasicResource>, Self>
pub fn into_generate_resource_response( self, ) -> Result<Option<BasicResource>, Self>
Returns the inner fields if this is a PlanetToExplorer::GenerateResourceResponse, otherwise returns back the enum in the Err case of the result
Sourcepub fn is_combine_resource_response(&self) -> bool
pub fn is_combine_resource_response(&self) -> bool
Returns true if this is a PlanetToExplorer::CombineResourceResponse, otherwise false
Sourcepub fn as_combine_resource_response_mut(
&mut self,
) -> Option<&mut Result<ComplexResource, (String, GenericResource, GenericResource)>>
pub fn as_combine_resource_response_mut( &mut self, ) -> Option<&mut Result<ComplexResource, (String, GenericResource, GenericResource)>>
Optionally returns mutable references to the inner fields if this is a PlanetToExplorer::CombineResourceResponse, otherwise None
Sourcepub fn as_combine_resource_response(
&self,
) -> Option<&Result<ComplexResource, (String, GenericResource, GenericResource)>>
pub fn as_combine_resource_response( &self, ) -> Option<&Result<ComplexResource, (String, GenericResource, GenericResource)>>
Optionally returns references to the inner fields if this is a PlanetToExplorer::CombineResourceResponse, otherwise None
Sourcepub fn into_combine_resource_response(
self,
) -> Result<Result<ComplexResource, (String, GenericResource, GenericResource)>, Self>
pub fn into_combine_resource_response( self, ) -> Result<Result<ComplexResource, (String, GenericResource, GenericResource)>, Self>
Returns the inner fields if this is a PlanetToExplorer::CombineResourceResponse, otherwise returns back the enum in the Err case of the result
Sourcepub fn is_available_energy_cell_response(&self) -> bool
pub fn is_available_energy_cell_response(&self) -> bool
Returns true if this is a PlanetToExplorer::AvailableEnergyCellResponse, otherwise false
Sourcepub fn as_available_energy_cell_response_mut(&mut self) -> Option<&mut ID>
pub fn as_available_energy_cell_response_mut(&mut self) -> Option<&mut ID>
Optionally returns mutable references to the inner fields if this is a PlanetToExplorer::AvailableEnergyCellResponse, otherwise None
Sourcepub fn as_available_energy_cell_response(&self) -> Option<&ID>
pub fn as_available_energy_cell_response(&self) -> Option<&ID>
Optionally returns references to the inner fields if this is a PlanetToExplorer::AvailableEnergyCellResponse, otherwise None
Sourcepub fn into_available_energy_cell_response(self) -> Result<ID, Self>
pub fn into_available_energy_cell_response(self) -> Result<ID, Self>
Returns the inner fields if this is a PlanetToExplorer::AvailableEnergyCellResponse, 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 PlanetToExplorer::Stopped, otherwise false