rust_sc2::units::iter

Trait UnitsIterator

Source
pub trait UnitsIterator: Iterator + Sized
where Self::Item: Borrow<Unit>,
{
Show 19 methods // Provided methods fn find_tag(self, tag: u64) -> Option<Self::Item> { ... } fn find_tags<T: Container<u64>>(self, tags: &T) -> FindTags<'_, Self, T> { ... } fn of_type(self, unit_type: UnitTypeId) -> OfType<Self> { ... } fn exclude_type(self, unit_type: UnitTypeId) -> ExcludeType<Self> { ... } fn of_types<T: Container<UnitTypeId>>( self, types: &T, ) -> OfTypes<'_, Self, T> { ... } fn exclude_types<T: Container<UnitTypeId>>( self, types: &T, ) -> ExcludeTypes<'_, Self, T> { ... } fn ground(self) -> Ground<Self> { ... } fn flying(self) -> Flying<Self> { ... } fn ready(self) -> Ready<Self> { ... } fn not_ready(self) -> NotReady<Self> { ... } fn idle(self) -> Idle<Self> { ... } fn almost_idle(self) -> AlmostIdle<Self> { ... } fn unused(self) -> Unused<Self> { ... } fn almost_unused(self) -> AlmostUnused<Self> { ... } fn visible(self) -> Visible<Self> { ... } fn in_range_of(self, unit: &Unit, gap: f32) -> InRangeOf<'_, Self> { ... } fn in_range(self, unit: &Unit, gap: f32) -> InRange<'_, Self> { ... } fn in_real_range_of(self, unit: &Unit, gap: f32) -> InRealRangeOf<'_, Self> { ... } fn in_real_range(self, unit: &Unit, gap: f32) -> InRealRange<'_, Self> { ... }
}
Expand description

Helper trait for iterators over units.

Provided Methods§

Source

fn find_tag(self, tag: u64) -> Option<Self::Item>

Searches for unit with given tag and returns it if found.

Source

fn find_tags<T: Container<u64>>(self, tags: &T) -> FindTags<'_, Self, T>

Leaves only units with given tags.

Source

fn of_type(self, unit_type: UnitTypeId) -> OfType<Self>

Leaves only units of given type.

Source

fn exclude_type(self, unit_type: UnitTypeId) -> ExcludeType<Self>

Excludes units of given type.

Source

fn of_types<T: Container<UnitTypeId>>(self, types: &T) -> OfTypes<'_, Self, T>

Leaves only units of given types.

Source

fn exclude_types<T: Container<UnitTypeId>>( self, types: &T, ) -> ExcludeTypes<'_, Self, T>

Excludes units of given types.

Source

fn ground(self) -> Ground<Self>

Leaves only non-flying units.

Source

fn flying(self) -> Flying<Self>

Leaves only flying units.

Source

fn ready(self) -> Ready<Self>

Leaves only ready structures.

Source

fn not_ready(self) -> NotReady<Self>

Leaves only structures in-progress.

Source

fn idle(self) -> Idle<Self>

Leaves only units with no orders.

Source

fn almost_idle(self) -> AlmostIdle<Self>

Leaves only units with no orders or that almost finished their orders.

Source

fn unused(self) -> Unused<Self>

Leaves only units with no orders. Unlike idle this takes reactor on terran buildings into account.

Source

fn almost_unused(self) -> AlmostUnused<Self>

Leaves only units with no orders or that almost finished their orders. Unlike almost_idle this takes reactor on terran buildings into account.

Source

fn visible(self) -> Visible<Self>

Leaves only units visible on current step.

Source

fn in_range_of(self, unit: &Unit, gap: f32) -> InRangeOf<'_, Self>

Leaves only units in attack range of given unit.

Source

fn in_range(self, unit: &Unit, gap: f32) -> InRange<'_, Self>

Leaves only units that are close enough to attack given unit.

Source

fn in_real_range_of(self, unit: &Unit, gap: f32) -> InRealRangeOf<'_, Self>

Leaves only units in attack range of given unit. Unlike in_range_of this takes range upgrades into account.

Source

fn in_real_range(self, unit: &Unit, gap: f32) -> InRealRange<'_, Self>

Leaves only units that are close enough to attack given unit. Unlike in_range this takes range upgrades into account.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<I> UnitsIterator for I
where I: Iterator + Sized, I::Item: Borrow<Unit>,