pub enum AgentKind {
    Player(Player),
    Gadget(Gadget),
    Character(Character),
}
Expand description

The type of an agent.

arcdps differentiates between three types of agents: Player, Character and Gadget. This enum unifies handling between them by allowing you to pattern match or use one of the accessor methods.

The main way to obtain a AgentKind is by using the .kind() method on an Agent. In cases where you already have a raw::Agent available, you can also use the TryFrom/TryInto traits to convert a raw::Agent or &raw::Agent to a AgentKind:

use std::convert::TryInto;
// Get a raw::Agent from somewhere
let raw_agent: raw::Agent = panic!();
// Convert it
let agent: AgentKind = raw_agent.try_into().unwrap();

Variants

Player(Player)

The agent is a player.

The player-specific data is in the included Player struct.

Gadget(Gadget)

The agent is a gadget.

The gadget-specific data is in the included Gadget struct.

Character(Character)

The agent is a character.

The character-specific data is in the included Character struct.

Implementations

Accesses the inner Player struct, if available.

Determines whether this AgentKind contains a player.

Accesses the inner Gadget struct, if available.

Determines whether this AgentKind contains a gadget.

Accesses the inner Character struct, if available.

Determines whether this AgentKind contains a character.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Extract the correct AgentKind from the given raw agent.

This automatically discerns between player, gadget and characters.

Note that in most cases, you probably want to use Agent::try_from or even process instead of this function.

The type returned in the event of a conversion error.

Convenience method to avoid manual borrowing.

Note that this conversion will consume the agent, so if you plan on re-using it, use the TryFrom<&raw::Agent> implementation that works with a reference.

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.