ExplorerToPlanet

Enum ExplorerToPlanet 

Source
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

Fields

§explorer_id: ID

The ID of the Explorer sending the message

§

SupportedCombinationRequest

This variant is used to ask the Planet for the available ComplexResourceType

Expected Response: PlanetToExplorer::SupportedCombinationResponse

Use Case: Asking Available Complex Resources

Fields

§explorer_id: ID

The ID of the Explorer sending the message

§

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

§explorer_id: ID

The ID of the Explorer sending the message

§resource: BasicResourceType

The 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

§explorer_id: ID

The ID of the Explorer sending the message

§msg: ComplexResourceRequest

The 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

Fields

§explorer_id: ID

The ID of the Explorer sending the message

Implementations§

Source§

impl ExplorerToPlanet

Source

pub fn is_supported_resource_request(&self) -> bool

Returns true if this is a ExplorerToPlanet::SupportedResourceRequest, otherwise false

Source

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

Source

pub fn as_supported_resource_request(&self) -> Option<&ID>

Optionally returns references to the inner fields if this is a ExplorerToPlanet::SupportedResourceRequest, otherwise None

Source

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

Source

pub fn is_supported_combination_request(&self) -> bool

Returns true if this is a ExplorerToPlanet::SupportedCombinationRequest, otherwise false

Source

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

Source

pub fn as_supported_combination_request(&self) -> Option<&ID>

Optionally returns references to the inner fields if this is a ExplorerToPlanet::SupportedCombinationRequest, otherwise None

Source

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

Source

pub fn is_generate_resource_request(&self) -> bool

Returns true if this is a ExplorerToPlanet::GenerateResourceRequest, otherwise false

Source

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

Source

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

Source

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

Source

pub fn is_combine_resource_request(&self) -> bool

Returns true if this is a ExplorerToPlanet::CombineResourceRequest, otherwise false

Source

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

Source

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

Source

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

Source

pub fn is_available_energy_cell_request(&self) -> bool

Returns true if this is a ExplorerToPlanet::AvailableEnergyCellRequest, otherwise false

Source

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

Source

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

Source

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

Source

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.

Trait Implementations§

Source§

impl Debug for ExplorerToPlanet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'_enum> From<&'_enum ExplorerToPlanet> for ExplorerToPlanetKind

Source§

fn from(val: &'_enum ExplorerToPlanet) -> ExplorerToPlanetKind

Converts to this type from the input type.
Source§

impl From<ExplorerToPlanet> for ExplorerToPlanetKind

Source§

fn from(val: ExplorerToPlanet) -> ExplorerToPlanetKind

Converts to this type from the input type.
Source§

impl IntoDiscriminant for ExplorerToPlanet

Source§

type Discriminant = ExplorerToPlanetKind

Enum listing the same variants as this enum but without any data fields
Source§

fn discriminant(&self) -> Self::Discriminant

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.