ExplorerToOrchestrator

Enum ExplorerToOrchestrator 

Source
pub enum ExplorerToOrchestrator<T> {
Show 13 variants StartExplorerAIResult { explorer_id: ID, }, KillExplorerResult { explorer_id: ID, }, ResetExplorerAIResult { explorer_id: ID, }, StopExplorerAIResult { explorer_id: ID, }, MovedToPlanetResult { explorer_id: ID, planet_id: ID, }, CurrentPlanetResult { explorer_id: ID, planet_id: ID, }, SupportedResourceResult { explorer_id: ID, supported_resources: HashSet<BasicResourceType>, }, SupportedCombinationResult { explorer_id: ID, combination_list: HashSet<ComplexResourceType>, }, GenerateResourceResponse { explorer_id: ID, generated: Result<(), String>, }, CombineResourceResponse { explorer_id: ID, generated: Result<(), String>, }, BagContentResponse { explorer_id: ID, bag_content: T, }, NeighborsRequest { explorer_id: ID, current_planet_id: ID, }, TravelToPlanetRequest { explorer_id: ID, current_planet_id: ID, dst_planet_id: ID, },
}
Expand description

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

Variants§

§

StartExplorerAIResult

This variant is used to acknowledge the starting of the Explorer AI

Response To: OrchestratorToExplorer::StartExplorerAI

Fields

§explorer_id: ID

The ID of the Explorer sending the message

§

KillExplorerResult

This variant is used to acknowledge the killing of an Explorer

Response To: OrchestratorToExplorer::KillExplorer

Fields

§explorer_id: ID

The ID of the Explorer sending the message

§

ResetExplorerAIResult

This variant is used to acknowledge the reset of the Explorer AI

Response To: OrchestratorToExplorer::ResetExplorerAI

Fields

§explorer_id: ID

The ID of the Explorer sending the message

§

StopExplorerAIResult

This variant is used to acknowledge the stopping of the Explorer AI

Response To: OrchestratorToExplorer::StopExplorerAI

Fields

§explorer_id: ID

The ID of the Explorer sending the message

§

MovedToPlanetResult

This variant is used to acknowledge the transfer of an Explorer to a new Planet

Response To: OrchestratorToExplorer::MoveToPlanet

Fields

§explorer_id: ID

The ID of the Explorer sending the message

§planet_id: ID

The ID of the planet to which the explorer possibly moved

§

CurrentPlanetResult

This variant is used to send the ID of the current planet on which the Explorer is located

Response To: OrchestratorToExplorer::CurrentPlanetRequest

Fields

§explorer_id: ID

The ID of the explorer sending the message

§planet_id: ID

The ID of the planet it currently lives on

§

SupportedResourceResult

This variant is used to send the list of the available BasicResourceType in the Explorer’s current planet

Response To: OrchestratorToExplorer::SupportedResourceRequest

Fields

§explorer_id: ID

The ID of the explorer sending the message

§supported_resources: HashSet<BasicResourceType>

The Set of BasicResourceType available in the Explorer’s current planet

§

SupportedCombinationResult

This variant is used to send the list of the available ComplexResourceType in the Explorer’s current planet

Response To: OrchestratorToExplorer::SupportedCombinationRequest

Fields

§explorer_id: ID

The ID of the explorer sending the message

§combination_list: HashSet<ComplexResourceType>

The Set of ComplexResourceType available in the Explorer’s current planet

§

GenerateResourceResponse

This variant is used to send the generated Basic Resource asked by the Orchestrator

Response To: OrchestratorToExplorer::GenerateResourceRequest

Fields

§explorer_id: ID

The ID of the Explorer sending the message

§generated: Result<(), String>

A Result consisting of: Ok if the requested resource has been generated and added to the Explorer Bag

An Err String if the requested resource has not been generated

§

CombineResourceResponse

This variant is used to send the generated ComplexResource asked by the Orchestrator

Response To: OrchestratorToExplorer::CombineResourceRequest

Fields

§explorer_id: ID

The ID of the Explorer sending the message

§generated: Result<(), String>

A Result consisting of: Ok if the requested resource has been generated and added to the Explorer Bag

An Err String if the requested resource has not been generated

§

BagContentResponse

This message is for passing around the bag content and has been implemented with a generic type to let the group the freedom to implement the methods on it

Response To: OrchestratorToExplorer::BagContentRequest

Fields

§explorer_id: ID

The ID of the explorer sending the message

§bag_content: T

The generic bag_content type

§

NeighborsRequest

This variant asks the Orchestrator for the list of neighbors Planets to travel to

Expected Response: OrchestratorToExplorer::NeighborsResponse

Use Case: Knowing reachable planets from current planet

Fields

§explorer_id: ID

The ID of the Explorer sending the message

§current_planet_id: ID

The ID of the current planet the Explorer lives on

§

TravelToPlanetRequest

This variant asks the Orchestrator to be sent to the specified Planet

Expected Response: OrchestratorToExplorer::MoveToPlanet

Use Case: Autonomously asking to travel to a planet

Fields

§explorer_id: ID

The ID of the Explorer sending the message

§current_planet_id: ID

The ID of the current planet the Explorer lives on

§dst_planet_id: ID

The ID of the planet the Explorer wants to travel to

Implementations§

Source§

impl<T> ExplorerToOrchestrator<T>

Source

pub fn is_start_explorer_ai_result(&self) -> bool

Returns true if this is a ExplorerToOrchestrator::StartExplorerAIResult, otherwise false

Source

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

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

Source

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

Optionally returns references to the inner fields if this is a ExplorerToOrchestrator::StartExplorerAIResult, otherwise None

Source

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

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

Source

pub fn is_kill_explorer_result(&self) -> bool

Returns true if this is a ExplorerToOrchestrator::KillExplorerResult, otherwise false

Source

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

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

Source

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

Optionally returns references to the inner fields if this is a ExplorerToOrchestrator::KillExplorerResult, otherwise None

Source

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

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

Source

pub fn is_reset_explorer_ai_result(&self) -> bool

Returns true if this is a ExplorerToOrchestrator::ResetExplorerAIResult, otherwise false

Source

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

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

Source

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

Optionally returns references to the inner fields if this is a ExplorerToOrchestrator::ResetExplorerAIResult, otherwise None

Source

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

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

Source

pub fn is_stop_explorer_ai_result(&self) -> bool

Returns true if this is a ExplorerToOrchestrator::StopExplorerAIResult, otherwise false

Source

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

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

Source

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

Optionally returns references to the inner fields if this is a ExplorerToOrchestrator::StopExplorerAIResult, otherwise None

Source

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

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

Source

pub fn is_moved_to_planet_result(&self) -> bool

Returns true if this is a ExplorerToOrchestrator::MovedToPlanetResult, otherwise false

Source

pub fn as_moved_to_planet_result_mut(&mut self) -> Option<(&mut ID, &mut ID)>

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

Source

pub fn as_moved_to_planet_result(&self) -> Option<(&ID, &ID)>

Optionally returns references to the inner fields if this is a ExplorerToOrchestrator::MovedToPlanetResult, otherwise None

Source

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

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

Source

pub fn is_current_planet_result(&self) -> bool

Returns true if this is a ExplorerToOrchestrator::CurrentPlanetResult, otherwise false

Source

pub fn as_current_planet_result_mut(&mut self) -> Option<(&mut ID, &mut ID)>

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

Source

pub fn as_current_planet_result(&self) -> Option<(&ID, &ID)>

Optionally returns references to the inner fields if this is a ExplorerToOrchestrator::CurrentPlanetResult, otherwise None

Source

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

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

Source

pub fn is_supported_resource_result(&self) -> bool

Returns true if this is a ExplorerToOrchestrator::SupportedResourceResult, otherwise false

Source

pub fn as_supported_resource_result_mut( &mut self, ) -> Option<(&mut ID, &mut HashSet<BasicResourceType>)>

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

Source

pub fn as_supported_resource_result( &self, ) -> Option<(&ID, &HashSet<BasicResourceType>)>

Optionally returns references to the inner fields if this is a ExplorerToOrchestrator::SupportedResourceResult, otherwise None

Source

pub fn into_supported_resource_result( self, ) -> Result<(ID, HashSet<BasicResourceType>), Self>

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

Source

pub fn is_supported_combination_result(&self) -> bool

Returns true if this is a ExplorerToOrchestrator::SupportedCombinationResult, otherwise false

Source

pub fn as_supported_combination_result_mut( &mut self, ) -> Option<(&mut ID, &mut HashSet<ComplexResourceType>)>

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

Source

pub fn as_supported_combination_result( &self, ) -> Option<(&ID, &HashSet<ComplexResourceType>)>

Optionally returns references to the inner fields if this is a ExplorerToOrchestrator::SupportedCombinationResult, otherwise None

Source

pub fn into_supported_combination_result( self, ) -> Result<(ID, HashSet<ComplexResourceType>), Self>

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

Source

pub fn is_generate_resource_response(&self) -> bool

Returns true if this is a ExplorerToOrchestrator::GenerateResourceResponse, otherwise false

Source

pub fn as_generate_resource_response_mut( &mut self, ) -> Option<(&mut ID, &mut Result<(), String>)>

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

Source

pub fn as_generate_resource_response( &self, ) -> Option<(&ID, &Result<(), String>)>

Optionally returns references to the inner fields if this is a ExplorerToOrchestrator::GenerateResourceResponse, otherwise None

Source

pub fn into_generate_resource_response( self, ) -> Result<(ID, Result<(), String>), Self>

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

Source

pub fn is_combine_resource_response(&self) -> bool

Returns true if this is a ExplorerToOrchestrator::CombineResourceResponse, otherwise false

Source

pub fn as_combine_resource_response_mut( &mut self, ) -> Option<(&mut ID, &mut Result<(), String>)>

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

Source

pub fn as_combine_resource_response(&self) -> Option<(&ID, &Result<(), String>)>

Optionally returns references to the inner fields if this is a ExplorerToOrchestrator::CombineResourceResponse, otherwise None

Source

pub fn into_combine_resource_response( self, ) -> Result<(ID, Result<(), String>), Self>

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

Source

pub fn is_bag_content_response(&self) -> bool

Returns true if this is a ExplorerToOrchestrator::BagContentResponse, otherwise false

Source

pub fn as_bag_content_response_mut(&mut self) -> Option<(&mut ID, &mut T)>

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

Source

pub fn as_bag_content_response(&self) -> Option<(&ID, &T)>

Optionally returns references to the inner fields if this is a ExplorerToOrchestrator::BagContentResponse, otherwise None

Source

pub fn into_bag_content_response(self) -> Result<(ID, T), Self>

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

Source

pub fn is_neighbors_request(&self) -> bool

Returns true if this is a ExplorerToOrchestrator::NeighborsRequest, otherwise false

Source

pub fn as_neighbors_request_mut(&mut self) -> Option<(&mut ID, &mut ID)>

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

Source

pub fn as_neighbors_request(&self) -> Option<(&ID, &ID)>

Optionally returns references to the inner fields if this is a ExplorerToOrchestrator::NeighborsRequest, otherwise None

Source

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

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

Source

pub fn is_travel_to_planet_request(&self) -> bool

Returns true if this is a ExplorerToOrchestrator::TravelToPlanetRequest, otherwise false

Source

pub fn as_travel_to_planet_request_mut( &mut self, ) -> Option<(&mut ID, &mut ID, &mut ID)>

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

Source

pub fn as_travel_to_planet_request(&self) -> Option<(&ID, &ID, &ID)>

Optionally returns references to the inner fields if this is a ExplorerToOrchestrator::TravelToPlanetRequest, otherwise None

Source

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

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

Source§

impl<T> ExplorerToOrchestrator<T>

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<T: Debug> Debug for ExplorerToOrchestrator<T>

Source§

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

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

impl<'_enum, T> From<&'_enum ExplorerToOrchestrator<T>> for ExplorerToOrchestratorKind

Source§

fn from(val: &'_enum ExplorerToOrchestrator<T>) -> ExplorerToOrchestratorKind

Converts to this type from the input type.
Source§

impl<T> From<ExplorerToOrchestrator<T>> for ExplorerToOrchestratorKind

Source§

fn from(val: ExplorerToOrchestrator<T>) -> ExplorerToOrchestratorKind

Converts to this type from the input type.
Source§

impl<T> IntoDiscriminant for ExplorerToOrchestrator<T>

Source§

type Discriminant = ExplorerToOrchestratorKind

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

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

Auto Trait Implementations§

§

impl<T> Freeze for ExplorerToOrchestrator<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for ExplorerToOrchestrator<T>
where T: RefUnwindSafe,

§

impl<T> Send for ExplorerToOrchestrator<T>
where T: Send,

§

impl<T> Sync for ExplorerToOrchestrator<T>
where T: Sync,

§

impl<T> Unpin for ExplorerToOrchestrator<T>
where T: Unpin,

§

impl<T> UnwindSafe for ExplorerToOrchestrator<T>
where T: UnwindSafe,

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.