[−][src]Enum evtclib::AgentKind
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
impl AgentKind
[src]
pub fn as_player(&self) -> Option<&Player>
[src]
Accesses the inner Player
struct, if available.
pub fn is_player(&self) -> bool
[src]
Determines whether this AgentKind
contains a player.
pub fn as_gadget(&self) -> Option<&Gadget>
[src]
Accesses the inner Gadget
struct, if available.
pub fn is_gadget(&self) -> bool
[src]
Determines whether this AgentKind
contains a gadget.
pub fn as_character(&self) -> Option<&Character>
[src]
Accesses the inner Character
struct, if available.
pub fn is_character(&self) -> bool
[src]
Determines whether this AgentKind
contains a character.
Trait Implementations
impl Clone for AgentKind
[src]
impl Debug for AgentKind
[src]
impl Eq for AgentKind
[src]
impl Hash for AgentKind
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<AgentKind> for AgentKind
[src]
impl StructuralEq for AgentKind
[src]
impl StructuralPartialEq for AgentKind
[src]
impl<'_> TryFrom<&'_ Agent> for AgentKind
[src]
type Error = EvtcError
The type returned in the event of a conversion error.
fn try_from(raw_agent: &Agent) -> Result<Self, Self::Error>
[src]
impl TryFrom<Agent> for AgentKind
[src]
type Error = EvtcError
The type returned in the event of a conversion error.
fn try_from(raw_agent: Agent) -> Result<Self, Self::Error>
[src]
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.
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,