rust_sc2::unit

Struct Unit

Source
pub struct Unit { /* private fields */ }
Expand description

Unit structure contains some raw data, helper methods for it’s analysis and some methods for actions execution.

Implementations§

Source§

impl Unit

Source

pub fn display_type(&self) -> DisplayType

How unit is displayed (i.e. visibility of unit).

Source

pub fn alliance(&self) -> Alliance

Unit is owned, enemy or just neutral.

Source

pub fn tag(&self) -> u64

Unique and constant for each unit tag. Used to find exactly the same unit in bunch of Units. See also get, get_mut and find_tags.

Source

pub fn type_id(&self) -> UnitTypeId

The type of unit.

Source

pub fn owner(&self) -> u32

Player id of the owner. Normally it should match your player_id for owned units and enemy_player_id for opponent’s units.

Source

pub fn position(&self) -> Point2

Position on 2D grid.

Source

pub fn position3d(&self) -> Point3

Position in 3D world space.

Source

pub fn facing(&self) -> f32

Unit rotation angle (i.e. the direction unit is facing). Value in range [0, 2π).

Source

pub fn radius(&self) -> f32

Radius of the unit.

Source

pub fn build_progress(&self) -> f32

The progress of building construction. Value from 0 to 1.

Source

pub fn is_cloaked(&self) -> bool

true when unit is burrowed or has cloak field turned on.

Source

pub fn is_revealed(&self) -> bool

true when unit is detected.

Source

pub fn buffs(&self) -> &FxHashSet<BuffId>

Set of buffs unit has.

Source

pub fn detect_range(&self) -> f32

Detection range of detector or 0 if unit is not detector. See also is_detector.

Source

pub fn radar_range(&self) -> f32

Range of terran’s sensor tower.

Source

pub fn is_selected(&self) -> bool

Unit is selected.

Source

pub fn is_on_screen(&self) -> bool

Unit is visible in game window.

Source

pub fn is_blip(&self) -> bool

Enemies detected by sensor tower.

Source

pub fn is_powered(&self) -> bool

Protoss structure is powered by pylon.

Source

pub fn is_active(&self) -> bool

Building is training/researching (i.e. animated).

Source

pub fn attack_upgrade_level(&self) -> u32

General attack upgrade level without considering buffs and special upgrades.

Source

pub fn armor_upgrade_level(&self) -> i32

General armor upgrade level without considering buffs and special upgrades.

Source

pub fn shield_upgrade_level(&self) -> i32

General shield upgrade level without considering buffs and special upgrades.

Source

pub fn health(&self) -> Option<u32>

Current health of unit.

Note: Not populated for snapshots.

Source

pub fn health_max(&self) -> Option<u32>

Maximum health of unit.

Note: Not populated for snapshots.

Source

pub fn shield(&self) -> Option<u32>

Current shield of protoss unit.

Note: Not populated for snapshots.

Source

pub fn shield_max(&self) -> Option<u32>

Maximum shield of protoss unit.

Note: Not populated for snapshots.

Source

pub fn energy(&self) -> Option<u32>

Current energy of caster unit.

Note: Not populated for snapshots.

Source

pub fn energy_max(&self) -> Option<u32>

Maximum energy of caster unit.

Note: Not populated for snapshots.

Source

pub fn mineral_contents(&self) -> Option<u32>

Amount of minerals left in mineral field.

Note: Not populated for snapshots.

Source

pub fn vespene_contents(&self) -> Option<u32>

Amount of vespene gas left in vespene geyser.

Note: Not populated for snapshots.

Source

pub fn is_flying(&self) -> bool

Unit is flying.

Note: Not populated for snapshots.

Source

pub fn is_burrowed(&self) -> bool

Zerg unit is burrowed.

Note: Not populated for snapshots.

Source

pub fn is_hallucination(&self) -> bool

Is hallucination created by protoss sentry.

Note: Not populated for snapshots.

Source

pub fn orders(&self) -> &[UnitOrder]

Current orders of unit.

Note: Not populated for enemies.

Source

pub fn addon_tag(&self) -> Option<u64>

Tag of addon if any.

Note: Not populated for enemies.

Source

pub fn passengers(&self) -> &[PassengerUnit]

Units inside transport or bunker.

Note: Not populated for enemies.

Source

pub fn cargo_space_taken(&self) -> Option<u32>

Used space of transport or bunker.

Note: Not populated for enemies.

Source

pub fn cargo_space_max(&self) -> Option<u32>

Maximum space of transport or bunker.

Note: Not populated for enemies.

Source

pub fn assigned_harvesters(&self) -> Option<u32>

Current number of workers on gas or base.

Note: Not populated for enemies.

Source

pub fn ideal_harvesters(&self) -> Option<u32>

Ideal number of workers on gas or base.

Note: Not populated for enemies.

Source

pub fn weapon_cooldown(&self) -> Option<f32>

Frames left until weapon will be ready to shot.

Note: Not populated for enemies.

Source

pub fn engaged_target_tag(&self) -> Option<u64>

Source

pub fn buff_duration_remain(&self) -> Option<u32>

How long a buff or unit is still around (e.g. mule, broodling, chronoboost).

Note: Not populated for enemies.

Source

pub fn buff_duration_max(&self) -> Option<u32>

How long the maximum duration of buff or unit (e.g. mule, broodling, chronoboost).

Note: Not populated for enemies.

Source

pub fn rally_targets(&self) -> &[RallyTarget]

All rally points of structure.

Note: Not populated for enemies.

Source

pub fn name(&self) -> &str

Name of the unit

Source

pub fn is_worker(&self) -> bool

Checks if unit is worker.

Source

pub fn is_townhall(&self) -> bool

Checks if it’s townhall.

Source

pub fn is_addon(&self) -> bool

Checks if it’s addon.

Source

pub fn is_melee(&self) -> bool

Checks if unit is melee attacker.

Source

pub fn is_mineral(&self) -> bool

Checks if it’s mineral field.

Source

pub fn is_geyser(&self) -> bool

Checks if it’s vespene geyser.

Source

pub fn is_detector(&self) -> bool

Checks if unit is detector.

Source

pub fn is_ready(&self) -> bool

Building construction is complete.

Source

pub fn is_almost_ready(&self) -> bool

Building construction is more than 95% complete.

Source

pub fn has_addon(&self) -> bool

Terran building has addon.

Source

pub fn has_techlab(&self) -> bool

Terran building’s addon is techlab if any.

Source

pub fn has_reactor(&self) -> bool

Terran building’s addon is reactor if any.

Source

pub fn is_attacked(&self) -> bool

Unit was attacked on last step.

Source

pub fn damage_taken(&self) -> u32

The damage was taken by unit if it was attacked, otherwise it’s 0.

Source

pub fn abilities(&self) -> Option<FxHashSet<AbilityId>>

Abilities available for unit to use.

Ability won’t be available if it’s on cooldown, unit is out of energy or bot doesn’t have enough resources.

Source

pub fn has_ability(&self, ability: AbilityId) -> bool

Checks if ability is available for unit.

Ability won’t be available if it’s on cooldown, unit is out of energy or bot doesn’t have enough resources.

Source

pub fn race(&self) -> Race

Race of unit, dependent on it’s type.

Source

pub fn has_cargo(&self) -> bool

There’re some units inside transport or bunker.

Source

pub fn cargo_left(&self) -> Option<u32>

Free space left in transport or bunker.

Source

pub fn footprint_radius(&self) -> Option<f32>

Half of building_size, but 2.5 for addons.

Source

pub fn building_size(&self) -> Option<usize>

Correct building size in tiles (e.g. 2 for supply and addons, 3 for barracks, 5 for command center).

Source

pub fn build_time(&self) -> f32

How long a unit takes to build.

Source

pub fn cargo_size(&self) -> u32

Space that unit takes in transports and bunkers.

Source

pub fn sight_range(&self) -> f32

How far unit can see.

Source

pub fn armor(&self) -> i32

Initial armor of unit without considering upgrades and buffs.

Source

pub fn towards_facing(&self, offset: f32) -> Point2

Returns point with given offset towards unit face direction.

Source

pub fn is_visible(&self) -> bool

Checks if unit is fully visible.

Source

pub fn is_snapshot(&self) -> bool

Checks if unit is snapshot (i.e. hidden in fog of war or on high ground).

Source

pub fn is_hidden(&self) -> bool

Checks if unit is fully hidden.

Source

pub fn is_placeholder(&self) -> bool

Checks if unit is building placeholder.

Source

pub fn is_mine(&self) -> bool

Checks if unit is owned.

Source

pub fn is_enemy(&self) -> bool

Checks if unit is enemy.

Source

pub fn is_neutral(&self) -> bool

Checks if unit is neutral.

Source

pub fn is_ally(&self) -> bool

Checks if unit is allied, but not owned.

Source

pub fn can_be_attacked(&self) -> bool

Checks if unit is detected or not even cloaked.

Source

pub fn is_invisible(&self) -> bool

Checks if unit is burrowed or cloaked, and not detected (i.e. must be detected to be attacked).

Source

pub fn supply_cost(&self) -> f32

Returns how much supply this unit uses.

Source

pub fn cost(&self) -> Cost

Returns cost of unit.

Source

pub fn health_percentage(&self) -> Option<f32>

Returns health percentage (current health divided by max health). Value in range from 0 to 1.

Source

pub fn shield_percentage(&self) -> Option<f32>

Returns shield percentage (current shield divided by max shield). Value in range from 0 to 1.

Source

pub fn energy_percentage(&self) -> Option<f32>

Returns energy percentage (current energy divided by max energy). Value in range from 0 to 1.

Source

pub fn hits(&self) -> Option<u32>

Returns summed health and shield.

Not populated for snapshots.

Source

pub fn hits_max(&self) -> Option<u32>

Returns summed max health and max shield.

Not populated for snapshots.

Source

pub fn hits_percentage(&self) -> Option<f32>

Returns percentage of summed health and shield (current hits divided by max hits). Value in range from 0 to 1.

Not populated for snapshots.

Source

pub fn speed(&self) -> f32

Basic speed of the unit without considering buffs and upgrades.

Use real_speed to get speed including buffs and upgrades.

Source

pub fn real_speed(&self) -> f32

Returns actual speed of the unit calculated including buffs and upgrades.

Source

pub fn distance_per_step(&self) -> f32

Distance unit can travel per one step.

Source

pub fn distance_to_weapon_ready(&self) -> f32

Distance unit can travel until weapons be ready to fire.

Source

pub fn attributes(&self) -> &[Attribute]

Attributes of unit, dependent on it’s type.

Source

pub fn has_attribute(&self, attribute: Attribute) -> bool

Checks if unit has given attribute.

Source

pub fn is_light(&self) -> bool

Checks if unit has Light attribute.

Source

pub fn is_armored(&self) -> bool

Checks if unit has Armored attribute.

Source

pub fn is_biological(&self) -> bool

Checks if unit has Biological attribute.

Source

pub fn is_mechanical(&self) -> bool

Checks if unit has Mechanical attribute.

Source

pub fn is_robotic(&self) -> bool

Checks if unit has Robotic attribute.

Source

pub fn is_psionic(&self) -> bool

Checks if unit has Psionic attribute.

Source

pub fn is_massive(&self) -> bool

Checks if unit has Massive attribute.

Source

pub fn is_structure(&self) -> bool

Checks if unit has Structure attribute.

Source

pub fn is_hover(&self) -> bool

Checks if unit has Hover attribute.

Source

pub fn is_heroic(&self) -> bool

Checks if unit has Heroic attribute.

Source

pub fn is_summoned(&self) -> bool

Checks if unit has Summoned attribute.

Source

pub fn has_buff(&self, buff: BuffId) -> bool

Checks if unit has given buff.

Source

pub fn has_any_buff<'a, B: IntoIterator<Item = &'a BuffId>>( &self, buffs: B, ) -> bool

Checks if unit has any from given buffs.

Source

pub fn is_carrying_minerals(&self) -> bool

Checks if worker is carrying minerals.

Source

pub fn is_carrying_vespene(&self) -> bool

Checks if worker is carrying vespene gas (Currently not works if worker is carrying gas from rich vespene geyeser, because SC2 API is not providing this information).

Source

pub fn is_carrying_resource(&self) -> bool

Checks if worker is carrying any resource (Currently not works if worker is carrying gas from rich vespene geyeser, because SC2 API is not providing this information)

Source

pub fn weapons(&self) -> &[Weapon]

Source

pub fn weapon_target(&self) -> Option<TargetType>

Targets unit can attack if it has weapon.

Source

pub fn can_attack(&self) -> bool

Checks if unit can attack at all (i.e. has weapons).

Source

pub fn can_attack_both(&self) -> bool

Checks if unit can attack both air and ground targets.

Source

pub fn can_attack_ground(&self) -> bool

Checks if unit can attack ground targets.

Source

pub fn can_attack_air(&self) -> bool

Checks if unit can attack air targets.

Source

pub fn can_attack_unit(&self, target: &Unit) -> bool

Checks if unit can attack given target.

Source

pub fn on_cooldown(&self) -> bool

Checks if unit’s weapon is on cooldown.

Source

pub fn max_cooldown(&self) -> Option<f32>

Returns max cooldown in frames for unit’s weapon.

Source

pub fn cooldown_percentage(&self) -> Option<f32>

Returns weapon cooldown percentage (current cooldown divided by max cooldown). Value in range from 0 to 1.

Source

pub fn ground_range(&self) -> f32

Returns ground range of unit’s weapon without considering upgrades. Use real_ground_range to get range including upgrades.

Source

pub fn air_range(&self) -> f32

Returns air range of unit’s weapon without considering upgrades. Use real_air_range to get range including upgrades.

Source

pub fn range_vs(&self, target: &Unit) -> f32

Returns range of unit’s weapon vs given target if unit can it, otherwise returns 0. Doesn’t consider upgrades, use real_range_vs instead to get range including upgrades.

Source

pub fn real_ground_range(&self) -> f32

Returns actual ground range of unit’s weapon including upgrades.

Source

pub fn real_air_range(&self) -> f32

Returns actual air range of unit’s weapon including upgrades.

Source

pub fn real_range_vs(&self, target: &Unit) -> f32

Returns actual range of unit’s weapon vs given target if unit can attack it, otherwise returs 0. Takes upgrades into account.

Source

pub fn ground_dps(&self) -> f32

Returns ground dps of unit’s weapon without considering upgrades. Use real_ground_weapon to get dps including upgrades.

Source

pub fn air_dps(&self) -> f32

Returns air dps of unit’s weapon without considering upgrades. Use real_air_weapon to get dps including upgrades.

Source

pub fn dps_vs(&self, target: &Unit) -> f32

Returns dps of unit’s weapon vs given target if unit can it, otherwise returns 0. Doesn’t consider upgrades, use real_weapon_vs instead to get dps including upgrades.

Source

pub fn real_weapon(&self, attributes: &[Attribute]) -> (f32, f32)

Returns (dps, range) of first unit’s weapon including bonuses from buffs and upgrades.

If you need to get only real range of unit, use real_ground_range, real_air_range or real_range_vs instead, because they’re generally faster.

Source

pub fn real_ground_weapon(&self, attributes: &[Attribute]) -> (f32, f32)

Returns (dps, range) of unit’s ground weapon including bonuses from buffs and upgrades.

If you need to get only real range of unit, use real_ground_range instead, because it’s generally faster.

Source

pub fn real_air_weapon(&self, attributes: &[Attribute]) -> (f32, f32)

Returns (dps, range) of unit’s air weapon including bonuses from buffs and upgrades.

If you need to get only real range of unit, use real_air_range instead, because it’s generally faster.

Source

pub fn real_weapon_vs(&self, target: &Unit) -> (f32, f32)

Returns (dps, range) of unit’s weapon vs given target if unit can attack it, otherwise returs (0, 0). Takes buffs and upgrades into account.

If you need to get only real range of unit, use real_range_vs instead, because it’s generally faster.

Source

pub fn calculate_weapon_abstract( &self, target_type: TargetType, attributes: &[Attribute], ) -> (f32, f32)

Returns (dps, range) of unit’s weapon vs given abstract target if unit can attack it, otherwise returs (0, 0). Abstract target is described by it’s type (air or ground) and attributes (e.g. light, armored, …).

If you need to get only real range of unit, use real_ground_range, real_air_range or real_range_vs instead, because they’re generally faster.

Source

pub fn calculate_weapon_stats(&self, target: CalcTarget<'_>) -> (f32, f32)

Returns (dps, range) of unit’s weapon vs given target (can be unit or abstract) if unit can attack it, otherwise returs (0, 0).

If you need to get only real range of unit, use real_ground_range, real_air_range or real_range_vs instead, because they’re generally faster.

Source

pub fn in_range(&self, target: &Unit, gap: f32) -> bool

Checks if unit is close enough to attack given target.

See also in_real_range which uses actual range of unit for calculations.

Source

pub fn in_range_of(&self, threat: &Unit, gap: f32) -> bool

Checks if unit is close enough to be attacked by given threat. This unit.in_range_of(threat, gap) is equivalent to threat.in_range(unit, gap).

See also in_real_range_of which uses actual range of unit for calculation.

Source

pub fn in_real_range(&self, target: &Unit, gap: f32) -> bool

Checks if unit is close enough to attack given target.

Uses actual range from real_range_vs in it’s calculations.

Source

pub fn in_real_range_of(&self, threat: &Unit, gap: f32) -> bool

Checks if unit is close enough to be attacked by given threat. This unit.in_real_range_of(threat, gap) is equivalent to threat.in_real_range(unit, gap).

Uses actual range from real_range_vs in it’s calculations.

Source

pub fn in_ability_cast_range<A>( &self, ability_id: AbilityId, target: A, gap: f32, ) -> bool
where A: Into<Point2> + Radius,

Checks if unit is close enough to use given ability on target.

Source

pub fn damage_bonus(&self) -> Option<(Attribute, u32)>

Returns (attribute, bonus damage) for first unit’s weapon if any.

Source

pub fn order(&self) -> Option<(AbilityId, Target, f32)>

Returns (ability, target, progress) of the current unit order or None if it’s idle.

Source

pub fn target(&self) -> Target

Returns target of first unit’s order.

Source

pub fn target_pos(&self) -> Option<Point2>

Returns target point of unit’s order if any.

Source

pub fn target_tag(&self) -> Option<u64>

Returns target tag of unit’s order if any.

Source

pub fn ordered_ability(&self) -> Option<AbilityId>

Returns ability of first unit’s order.

Source

pub fn is_idle(&self) -> bool

Checks if unit don’t have any orders currently.

Source

pub fn is_almost_idle(&self) -> bool

Checks if unit don’t have any orders currently or it’s order is more than 95% complete.

Source

pub fn is_unused(&self) -> bool

Checks if production building with reactor don’t have any orders currently.

Source

pub fn is_almost_unused(&self) -> bool

Checks if production building with reactor don’t have any orders currently or it’s order is more than 95% complete.

Source

pub fn is_using(&self, ability: AbilityId) -> bool

Checks if unit is using given ability.

Doesn’t work with enemies.

Source

pub fn is_using_any<A: Container<AbilityId>>(&self, abilities: &A) -> bool

Checks if unit is using any of given abilities.

Doesn’t work with enemies.

Source

pub fn is_attacking(&self) -> bool

Checks if unit is currently attacking.

Doesn’t work with enemies.

Source

pub fn is_moving(&self) -> bool

Checks if unit is currently moving.

Doesn’t work with enemies.

Source

pub fn is_patrolling(&self) -> bool

Checks if unit is currently patrolling.

Doesn’t work with enemies.

Source

pub fn is_repairing(&self) -> bool

Checks if SCV or MULE is currently repairing.

Doesn’t work with enemies.

Source

pub fn is_gathering(&self) -> bool

Checks if worker is currently gathering resource.

Doesn’t work with enemies.

Source

pub fn is_returning(&self) -> bool

Checks if worker is currently returning resource closest base.

Doesn’t work with enemies.

Source

pub fn is_collecting(&self) -> bool

Checks if worker is currently gathering or returning resources.

Doesn’t work with enemies.

Source

pub fn is_constructing(&self) -> bool

Checks if worker is currently constructing a building.

Doesn’t work with enemies.

Source

pub fn is_making_addon(&self) -> bool

Checks if terran building is currently making addon.

Doesn’t work with enemies.

Source

pub fn is_making_techlab(&self) -> bool

Checks if terran building is currently building techlab.

Doesn’t work with enemies.

Source

pub fn is_making_reactor(&self) -> bool

Checks if terran building is currently building reactor.

Doesn’t work with enemies.

Source

pub fn is_sleeping(&self) -> bool

Checks if unit is doing something important and it’s bad idea to interrupt it, so you can skip evaluating it anyway.

Use with sleep to skip evaluating units executing durable commands.

Source

pub fn sleep(&self, duration: u32)

Makes unit ignore all your commands for given amount of frames.

Use with is_sleeping to skip evaluating units executing durable commands.

Source

pub fn toggle_autocast(&self, ability: AbilityId)

Toggles autocast on given ability.

Source

pub fn command(&self, ability: AbilityId, target: Target, queue: bool)

Orders unit to execute given command.

Source

pub fn use_ability(&self, ability: AbilityId, queue: bool)

Orders unit to use given ability (This is equivalent of unit.command(ability, Target::None, queue)).

Source

pub fn smart(&self, target: Target, queue: bool)

Orders unit a Smart ability (This is equivalent of right click).

Source

pub fn attack(&self, target: Target, queue: bool)

Orders unit to attack given target.

Source

pub fn move_to(&self, target: Target, queue: bool)

Orders unit to move to given target.

Source

pub fn hold_position(&self, queue: bool)

Orders unit to hold position.

Source

pub fn gather(&self, target: u64, queue: bool)

Orders worker to gather given resource.

Source

pub fn return_resource(&self, queue: bool)

Orders worker to return resource to closest base.

Source

pub fn stop(&self, queue: bool)

Orders unit to stop actions.

Source

pub fn patrol(&self, target: Target, queue: bool)

Orders unit to patrol.

Source

pub fn repair(&self, target: u64, queue: bool)

Orders SCV or MULE to repair given structure or mechanical unit.

Source

pub fn cancel_building(&self, queue: bool)

Orders building which is in progress to cancel construction.

Source

pub fn cancel_queue(&self, queue: bool)

Orders production building to cancel last unit in train queue.

Source

pub fn build_gas(&self, target: u64, queue: bool)

Orders worker to build race gas building on given geyser.

Source

pub fn build(&self, unit: UnitTypeId, target: Point2, queue: bool)

Orders worker to build something on given position.

Source

pub fn train(&self, unit: UnitTypeId, queue: bool)

Orders production building to train given unit.

This also works for morphing units and building addons.

Source

pub fn research(&self, upgrade: UpgradeId, queue: bool)

Orders building to research given upgrade.

Source

pub fn warp_in(&self, unit: UnitTypeId, target: Point2)

Orders protoss warp gate to warp unit on given position.

Source

pub fn lift(&self, queue: bool)

Orders terran building to lift in the air.

Source

pub fn land(&self, target: Point2, queue: bool)

Orders flying terran building to land on given position.

Trait Implementations§

Source§

impl Clone for Unit

Source§

fn clone(&self) -> Unit

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Extend<Unit> for Units

Source§

fn extend<T: IntoIterator<Item = Unit>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl From<&Unit> for Point2

Source§

fn from(u: &Unit) -> Self

Converts to this type from the input type.
Source§

impl From<Unit> for Point2

Source§

fn from(u: Unit) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<Unit> for Units

Source§

fn from_iter<I: IntoIterator<Item = Unit>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl Radius for &Unit

Source§

fn radius(&self) -> f32

Radius for struct
Source§

impl Radius for Unit

Source§

fn radius(&self) -> f32

Radius for struct

Auto Trait Implementations§

§

impl Freeze for Unit

§

impl !RefUnwindSafe for Unit

§

impl !Send for Unit

§

impl !Sync for Unit

§

impl Unpin for Unit

§

impl !UnwindSafe for Unit

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> Distance for T
where T: Into<Point2>,

Source§

fn distance_squared<P: Into<Point2>>(self, other: P) -> f32

Calculates squared euclidean distance from self to other.
Source§

fn distance<P: Into<Point2>>(self, other: P) -> f32

Calculates euclidean distance from self to other.
Source§

fn is_closer<P: Into<Point2>>(self, distance: f32, other: P) -> bool

Checks if distance between self and other is less than given distance.
Source§

fn is_further<P: Into<Point2>>(self, distance: f32, other: P) -> bool

Checks if distance between self and other is greater than given distance.
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V