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
sourceimpl AgentKind
impl AgentKind
sourcepub fn as_character(&self) -> Option<&Character>
pub fn as_character(&self) -> Option<&Character>
Accesses the inner Character
struct, if available.
sourcepub fn is_character(&self) -> bool
pub fn is_character(&self) -> bool
Determines whether this AgentKind
contains a character.
Trait Implementations
sourceimpl TryFrom<&'_ Agent> for AgentKind
impl TryFrom<&'_ Agent> for AgentKind
sourceimpl TryFrom<Agent> for AgentKind
impl TryFrom<Agent> for AgentKind
impl Eq for AgentKind
impl StructuralEq for AgentKind
impl StructuralPartialEq for AgentKind
Auto Trait Implementations
impl RefUnwindSafe for AgentKind
impl Send for AgentKind
impl Sync for AgentKind
impl Unpin for AgentKind
impl UnwindSafe for AgentKind
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more