OrchestratorToExplorer

Enum OrchestratorToExplorer 

Source
pub enum OrchestratorToExplorer {
    StartExplorerAI,
    ResetExplorerAI,
    KillExplorer,
    StopExplorerAI,
    MoveToPlanet {
        sender_to_new_planet: Option<Sender<ExplorerToPlanet>>,
        planet_id: ID,
    },
    CurrentPlanetRequest,
    SupportedResourceRequest,
    SupportedCombinationRequest,
    GenerateResourceRequest {
        to_generate: BasicResourceType,
    },
    CombineResourceRequest {
        to_generate: ComplexResourceType,
    },
    BagContentRequest,
    NeighborsResponse {
        neighbors: Vec<ID>,
    },
}
Expand description

This enum describes all possible messages from the Orchestrator to an Explorer

Variants§

§

StartExplorerAI

This variant is used to start an Explorer AI

Expected Response: ExplorerToOrchestrator::StartExplorerAIResult

Use Case: Starting the Explorer AI at game start

§

ResetExplorerAI

This variant is used to reset the Explorer AI and restart it if it is in manual mode

Expected Response: ExplorerToOrchestrator::ResetExplorerAIResult

Use Case: Reset the Explorer knowledge or restart the AI if it is in manual mode

§

KillExplorer

This variant is used to kill an Explorer

Expected Response: ExplorerToOrchestrator::KillExplorerResult

Use Case: Killing the explorer instantly

§

StopExplorerAI

This variant is used to stop the Explorer AI from autonomous decision-making

Expected Response: ExplorerToOrchestrator::StopExplorerAIResult

Use Case: Stopping the autonomous decision-making and entering the manual mode

§

MoveToPlanet

This variant is used to tell the Explorer to move to a different planet

Expected Response: ExplorerToOrchestrator::MovedToPlanetResult

Use Case

When in manual mode, the orchestrator moves the explorer to a new planet and gives the new Sender

When in normal mode, this is the response to ExplorerToOrchestrator::TravelToPlanetRequest, in this case the orchestrator checks that the explorer can move to the planet specified in the request and sends the optional new sender

Fields

§sender_to_new_planet: Option<Sender<ExplorerToPlanet>>

The optional Sender to the new planet, None if explorer cannot move to the specified planet

§planet_id: ID

The ID of the planet to which the explorer will possibly move

§

CurrentPlanetRequest

This variant is used to ask the ID of the Planet in which the Explorer is currently located

Expected Response: ExplorerToOrchestrator::CurrentPlanetResult

§

SupportedResourceRequest

This variant is used to enforce the Explorer to ask the supported Resources on the Planet

Expected Response: ExplorerToOrchestrator::SupportedResourceResult

Use Case: In manual mode, ask the explorer to send a ExplorerToPlanet::SupportedResourceRequest to know the available BasicResourceType on its current planet

§

SupportedCombinationRequest

This variant is used to enforce the Explorer to ask the supported Combinations on the Planet

Expected Response: ExplorerToOrchestrator::SupportedCombinationResult

Use Case: In manual mode, ask the explorer to send a ExplorerToPlanet::SupportedCombinationRequest to know the available ComplexResourceType on its current planet

§

GenerateResourceRequest

This variant is used to enforce the Explorer to ask the Planet to Generate a BasicResource

Expected Response: ExplorerToOrchestrator::GenerateResourceResponse

Use Case: In manual mode, ask the explorer to send a ExplorerToPlanet::GenerateResourceRequest craft a BasicResource

Fields

§to_generate: BasicResourceType

The type of basic resource to craft

§

CombineResourceRequest

This variant is used to enforce the Explorer to ask the Planet to Generate a ComplexResource provided by ComplexResourceType

Expected Response: ExplorerToOrchestrator::CombineResourceResponse

Use Case: In manual mode, ask the explorer to send a ExplorerToPlanet::CombineResourceRequest to craft a ComplexResource

Fields

§to_generate: ComplexResourceType

The type of complex resource to generate

§

BagContentRequest

This variant is used to ask the content of the Explorer Bag

Expected Response: ExplorerToOrchestrator::BagContentResponse

Use Case: Message used by the GUI to get information on the Explorer bag content to be shown

§

NeighborsResponse

This variant is used to send to the Explorer the IDs of the planets to which it can be moved

Response To: ExplorerToOrchestrator::NeighborsRequest

Fields

§neighbors: Vec<ID>

The list of IDs of the planets to which it can be moved

Implementations§

Source§

impl OrchestratorToExplorer

Source

pub fn is_start_explorer_ai(&self) -> bool

Returns true if this is a OrchestratorToExplorer::StartExplorerAI, otherwise false

Source

pub fn is_reset_explorer_ai(&self) -> bool

Returns true if this is a OrchestratorToExplorer::ResetExplorerAI, otherwise false

Source

pub fn is_kill_explorer(&self) -> bool

Returns true if this is a OrchestratorToExplorer::KillExplorer, otherwise false

Source

pub fn is_stop_explorer_ai(&self) -> bool

Returns true if this is a OrchestratorToExplorer::StopExplorerAI, otherwise false

Source

pub fn is_move_to_planet(&self) -> bool

Returns true if this is a OrchestratorToExplorer::MoveToPlanet, otherwise false

Source

pub fn as_move_to_planet_mut( &mut self, ) -> Option<(&mut Option<Sender<ExplorerToPlanet>>, &mut ID)>

Optionally returns mutable references to the inner fields if this is a OrchestratorToExplorer::MoveToPlanet, otherwise None

Source

pub fn as_move_to_planet( &self, ) -> Option<(&Option<Sender<ExplorerToPlanet>>, &ID)>

Optionally returns references to the inner fields if this is a OrchestratorToExplorer::MoveToPlanet, otherwise None

Source

pub fn into_move_to_planet( self, ) -> Result<(Option<Sender<ExplorerToPlanet>>, ID), Self>

Returns the inner fields if this is a OrchestratorToExplorer::MoveToPlanet, otherwise returns back the enum in the Err case of the result

Source

pub fn is_current_planet_request(&self) -> bool

Returns true if this is a OrchestratorToExplorer::CurrentPlanetRequest, otherwise false

Source

pub fn is_supported_resource_request(&self) -> bool

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

Source

pub fn is_supported_combination_request(&self) -> bool

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

Source

pub fn is_generate_resource_request(&self) -> bool

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

Source

pub fn as_generate_resource_request_mut( &mut self, ) -> Option<&mut BasicResourceType>

Optionally returns mutable references to the inner fields if this is a OrchestratorToExplorer::GenerateResourceRequest, otherwise None

Source

pub fn as_generate_resource_request(&self) -> Option<&BasicResourceType>

Optionally returns references to the inner fields if this is a OrchestratorToExplorer::GenerateResourceRequest, otherwise None

Source

pub fn into_generate_resource_request(self) -> Result<BasicResourceType, Self>

Returns the inner fields if this is a OrchestratorToExplorer::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 OrchestratorToExplorer::CombineResourceRequest, otherwise false

Source

pub fn as_combine_resource_request_mut( &mut self, ) -> Option<&mut ComplexResourceType>

Optionally returns mutable references to the inner fields if this is a OrchestratorToExplorer::CombineResourceRequest, otherwise None

Source

pub fn as_combine_resource_request(&self) -> Option<&ComplexResourceType>

Optionally returns references to the inner fields if this is a OrchestratorToExplorer::CombineResourceRequest, otherwise None

Source

pub fn into_combine_resource_request(self) -> Result<ComplexResourceType, Self>

Returns the inner fields if this is a OrchestratorToExplorer::CombineResourceRequest, otherwise returns back the enum in the Err case of the result

Source

pub fn is_bag_content_request(&self) -> bool

Returns true if this is a OrchestratorToExplorer::BagContentRequest, otherwise false

Source

pub fn is_neighbors_response(&self) -> bool

Returns true if this is a OrchestratorToExplorer::NeighborsResponse, otherwise false

Source

pub fn as_neighbors_response_mut(&mut self) -> Option<&mut Vec<ID>>

Optionally returns mutable references to the inner fields if this is a OrchestratorToExplorer::NeighborsResponse, otherwise None

Source

pub fn as_neighbors_response(&self) -> Option<&Vec<ID>>

Optionally returns references to the inner fields if this is a OrchestratorToExplorer::NeighborsResponse, otherwise None

Source

pub fn into_neighbors_response(self) -> Result<Vec<ID>, Self>

Returns the inner fields if this is a OrchestratorToExplorer::NeighborsResponse, otherwise returns back the enum in the Err case of the result

Trait Implementations§

Source§

impl Debug for OrchestratorToExplorer

Source§

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

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

impl<'_enum> From<&'_enum OrchestratorToExplorer> for OrchestratorToExplorerKind

Source§

fn from(val: &'_enum OrchestratorToExplorer) -> OrchestratorToExplorerKind

Converts to this type from the input type.
Source§

impl From<OrchestratorToExplorer> for OrchestratorToExplorerKind

Source§

fn from(val: OrchestratorToExplorer) -> OrchestratorToExplorerKind

Converts to this type from the input type.
Source§

impl IntoDiscriminant for OrchestratorToExplorer

Source§

type Discriminant = OrchestratorToExplorerKind

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.