pub enum ExplorerToPlanet {
SupportedResourceRequest {
explorer_id: ID,
},
SupportedCombinationRequest {
explorer_id: ID,
},
GenerateResourceRequest {
explorer_id: ID,
resource: BasicResourceType,
},
CombineResourceRequest {
explorer_id: ID,
msg: ComplexResourceRequest,
},
AvailableEnergyCellRequest {
explorer_id: ID,
},
}Expand description
This enum describes all possible messages from an Explorer to a Planet.
Variants§
SupportedResourceRequest
This variant is used to ask the Planet for the available BasicResourceType
Expected Response: PlanetToExplorer::SupportedResourceResponse
Use Case: Asking Available Basic Resources
SupportedCombinationRequest
This variant is used to ask the Planet for the available ComplexResourceType
Expected Response: PlanetToExplorer::SupportedCombinationResponse
Use Case: Asking Available Complex Resources
GenerateResourceRequest
This variant is used to ask the Planet to generate a BasicResource
Expected Response: PlanetToExplorer::GenerateResourceResponse
Use Case: Asking to craft a Basic Resource
Fields
resource: BasicResourceTypeThe basic resource to be generated
CombineResourceRequest
This variant is used to ask the Planet to generate a ComplexResource using the ComplexResourceRequest
Expected Response: PlanetToExplorer::CombineResourceResponse
Use Case: Asking to craft a Complex Resource
Fields
msg: ComplexResourceRequestThe struct containing the complex resource to generate and the resources to be combined for the crafting to take place
AvailableEnergyCellRequest
This variant is used to ask the Planet for the available charged EnergyCell number
Expected Response: PlanetToExplorer::AvailableEnergyCellResponse
Use Case: Asking the number of charged cells available
Implementations§
Source§impl ExplorerToPlanet
impl ExplorerToPlanet
Sourcepub fn is_supported_resource_request(&self) -> bool
pub fn is_supported_resource_request(&self) -> bool
Returns true if this is a ExplorerToPlanet::SupportedResourceRequest, otherwise false
Sourcepub fn as_supported_resource_request_mut(&mut self) -> Option<&mut ID>
pub fn as_supported_resource_request_mut(&mut self) -> Option<&mut ID>
Optionally returns mutable references to the inner fields if this is a ExplorerToPlanet::SupportedResourceRequest, otherwise None
Sourcepub fn as_supported_resource_request(&self) -> Option<&ID>
pub fn as_supported_resource_request(&self) -> Option<&ID>
Optionally returns references to the inner fields if this is a ExplorerToPlanet::SupportedResourceRequest, otherwise None
Sourcepub fn into_supported_resource_request(self) -> Result<ID, Self>
pub fn into_supported_resource_request(self) -> Result<ID, Self>
Returns the inner fields if this is a ExplorerToPlanet::SupportedResourceRequest, otherwise returns back the enum in the Err case of the result
Sourcepub fn is_supported_combination_request(&self) -> bool
pub fn is_supported_combination_request(&self) -> bool
Returns true if this is a ExplorerToPlanet::SupportedCombinationRequest, otherwise false
Sourcepub fn as_supported_combination_request_mut(&mut self) -> Option<&mut ID>
pub fn as_supported_combination_request_mut(&mut self) -> Option<&mut ID>
Optionally returns mutable references to the inner fields if this is a ExplorerToPlanet::SupportedCombinationRequest, otherwise None
Sourcepub fn as_supported_combination_request(&self) -> Option<&ID>
pub fn as_supported_combination_request(&self) -> Option<&ID>
Optionally returns references to the inner fields if this is a ExplorerToPlanet::SupportedCombinationRequest, otherwise None
Sourcepub fn into_supported_combination_request(self) -> Result<ID, Self>
pub fn into_supported_combination_request(self) -> Result<ID, Self>
Returns the inner fields if this is a ExplorerToPlanet::SupportedCombinationRequest, otherwise returns back the enum in the Err case of the result
Sourcepub fn is_generate_resource_request(&self) -> bool
pub fn is_generate_resource_request(&self) -> bool
Returns true if this is a ExplorerToPlanet::GenerateResourceRequest, otherwise false
Sourcepub fn as_generate_resource_request_mut(
&mut self,
) -> Option<(&mut ID, &mut BasicResourceType)>
pub fn as_generate_resource_request_mut( &mut self, ) -> Option<(&mut ID, &mut BasicResourceType)>
Optionally returns mutable references to the inner fields if this is a ExplorerToPlanet::GenerateResourceRequest, otherwise None
Sourcepub fn as_generate_resource_request(&self) -> Option<(&ID, &BasicResourceType)>
pub fn as_generate_resource_request(&self) -> Option<(&ID, &BasicResourceType)>
Optionally returns references to the inner fields if this is a ExplorerToPlanet::GenerateResourceRequest, otherwise None
Sourcepub fn into_generate_resource_request(
self,
) -> Result<(ID, BasicResourceType), Self>
pub fn into_generate_resource_request( self, ) -> Result<(ID, BasicResourceType), Self>
Returns the inner fields if this is a ExplorerToPlanet::GenerateResourceRequest, otherwise returns back the enum in the Err case of the result
Sourcepub fn is_combine_resource_request(&self) -> bool
pub fn is_combine_resource_request(&self) -> bool
Returns true if this is a ExplorerToPlanet::CombineResourceRequest, otherwise false
Sourcepub fn as_combine_resource_request_mut(
&mut self,
) -> Option<(&mut ID, &mut ComplexResourceRequest)>
pub fn as_combine_resource_request_mut( &mut self, ) -> Option<(&mut ID, &mut ComplexResourceRequest)>
Optionally returns mutable references to the inner fields if this is a ExplorerToPlanet::CombineResourceRequest, otherwise None
Sourcepub fn as_combine_resource_request(
&self,
) -> Option<(&ID, &ComplexResourceRequest)>
pub fn as_combine_resource_request( &self, ) -> Option<(&ID, &ComplexResourceRequest)>
Optionally returns references to the inner fields if this is a ExplorerToPlanet::CombineResourceRequest, otherwise None
Sourcepub fn into_combine_resource_request(
self,
) -> Result<(ID, ComplexResourceRequest), Self>
pub fn into_combine_resource_request( self, ) -> Result<(ID, ComplexResourceRequest), Self>
Returns the inner fields if this is a ExplorerToPlanet::CombineResourceRequest, otherwise returns back the enum in the Err case of the result
Sourcepub fn is_available_energy_cell_request(&self) -> bool
pub fn is_available_energy_cell_request(&self) -> bool
Returns true if this is a ExplorerToPlanet::AvailableEnergyCellRequest, otherwise false
Sourcepub fn as_available_energy_cell_request_mut(&mut self) -> Option<&mut ID>
pub fn as_available_energy_cell_request_mut(&mut self) -> Option<&mut ID>
Optionally returns mutable references to the inner fields if this is a ExplorerToPlanet::AvailableEnergyCellRequest, otherwise None
Sourcepub fn as_available_energy_cell_request(&self) -> Option<&ID>
pub fn as_available_energy_cell_request(&self) -> Option<&ID>
Optionally returns references to the inner fields if this is a ExplorerToPlanet::AvailableEnergyCellRequest, otherwise None
Sourcepub fn into_available_energy_cell_request(self) -> Result<ID, Self>
pub fn into_available_energy_cell_request(self) -> Result<ID, Self>
Returns the inner fields if this is a ExplorerToPlanet::AvailableEnergyCellRequest, otherwise returns back the enum in the Err case of the result
Source§impl ExplorerToPlanet
impl ExplorerToPlanet
Sourcepub fn explorer_id(&self) -> ID
pub fn explorer_id(&self) -> ID
Helper method to extract the explorer_id field from any message variant
without needing to match a specific one.