pub struct Hex {
pub x: i32,
pub y: i32,
}Expand description
Hexagonal axial coordinates
§Why Axial ?
Axial coordinates allow to compute and use cubic coordinates with less storage, and allow:
- Vector operations
- Rotations
- Symmetry
- Simple algorithms
when offset and doubled coordinates don’t. Furthermore, it makes the
Hex behave like classic 2D coordinates (IVec2) and therefore more
user friendly.
Check out this comparison article for more information.
§Conversions
- Cubic: use
Self::zto compute the third axis - Offset: use
Self::from_offset_coordinatesandSelf::to_offset_coordinates - Doubled: use
Self::from_doubled_coordinatesandSelf::to_doubled_coordinates
Fields§
§x: i32x axial coordinate (sometimes called q or i)
y: i32y axial coordinate (sometimes called r or j)
Implementations§
Source§impl Hex
impl Hex
Sourcepub const fn to_doubled_coordinates(self, mode: DoubledHexMode) -> [i32; 2]
pub const fn to_doubled_coordinates(self, mode: DoubledHexMode) -> [i32; 2]
Converts self to doubled coordinates according to the given mode.
The coordinates are returned as [COLUMN, ROW]
Sourcepub const fn to_offset_coordinates(self, mode: OffsetHexMode) -> [i32; 2]
pub const fn to_offset_coordinates(self, mode: OffsetHexMode) -> [i32; 2]
Converts self to offset coordinates according to the given mode.
The coordinates are returned as [COLUMN, ROW]
Sourcepub const fn to_hexmod_coordinates(self, range: u32) -> u32
pub const fn to_hexmod_coordinates(self, range: u32) -> u32
Converts self to hexmod coordinates according to the given range
Sourcepub const fn from_hexmod_coordinates(coord: u32, range: u32) -> Hex
pub const fn from_hexmod_coordinates(coord: u32, range: u32) -> Hex
Sourcepub const fn from_doubled_coordinates(_: [i32; 2], mode: DoubledHexMode) -> Hex
pub const fn from_doubled_coordinates(_: [i32; 2], mode: DoubledHexMode) -> Hex
Sourcepub const fn from_offset_coordinates(_: [i32; 2], mode: OffsetHexMode) -> Hex
pub const fn from_offset_coordinates(_: [i32; 2], mode: OffsetHexMode) -> Hex
Source§impl Hex
impl Hex
Sourcepub const fn from_u64(value: u64) -> Hex
pub const fn from_u64(value: u64) -> Hex
Unpack from a u64.
x is read from the most signifigant 32 bits; y
is read from the least signifigant 32 bits. Intended to be used with
Hex::as_u64.
§Example
let x: u64 = 0x000000AA_FFFFFF45;
assert_eq!(Hex::from_u64(x), Hex::new(0xAA, -0xBB));Sourcepub const fn as_u64(self) -> u64
pub const fn as_u64(self) -> u64
Pack into a u64.
x is placed in the most signifigant 32 bits; y
is placed in the least signifigant 32 bits. Can be used as a sort
key, or for saving in a binary format. Intended to be used with
Hex::from_u64.
§Example
let x = Hex::new(0xAA, -0xBB).as_u64();
assert_eq!(x, 0x000000AA_FFFFFF45u64);Source§impl Hex
impl Hex
Sourcepub fn all_vertices(self) -> [GridVertex; 6]
pub fn all_vertices(self) -> [GridVertex; 6]
Returns all vertices of the given coordinate
Source§impl Hex
impl Hex
Sourcepub fn custom_ring(
self,
range: u32,
start_dir: EdgeDirection,
clockwise: bool,
) -> impl ExactSizeIterator
pub fn custom_ring( self, range: u32, start_dir: EdgeDirection, clockwise: bool, ) -> impl ExactSizeIterator
Retrieves one Hex ring around self in a given range.
The returned coordinates start from start_dir and loop counter
clockwise around self unless clockwise is set to true.
If you only need the coordinates see
Self::ring
§Note
The returned iterator will have 6 * range (Self::ring_count)
items, unless range is 0 which will return self
Sourcepub fn ring(self, range: u32) -> impl ExactSizeIterator
pub fn ring(self, range: u32) -> impl ExactSizeIterator
Retrieves one Hex ring around self in a given range.
The returned coordinates start from EdgeDirection::default
and loop around self counter clockwise.
See
Self::custom_ringfor more options.
§Note
The returned iterator will have 6 * range (Self::ring_count)
items, unless range is 0 which will return self
Sourcepub fn rings(
self,
range: impl Iterator<Item = u32>,
) -> impl Iterator<Item = Vec<Hex>>
pub fn rings( self, range: impl Iterator<Item = u32>, ) -> impl Iterator<Item = Vec<Hex>>
Retrieves range Hex rings around self in a given range.
The returned coordinates start from EdgeDirection::default
and loop around self counter clockwise.
See Self::custom_rings for more options.
If you only need the coordinates see Self::spiral_range.
§Example
let rings: Vec<Vec<Hex>> = Hex::ZERO.rings(3..10).collect();
assert_eq!(rings.len(), 7);Sourcepub fn custom_rings(
self,
range: impl Iterator<Item = u32>,
start_dir: EdgeDirection,
clockwise: bool,
) -> impl Iterator<Item = Vec<Hex>>
pub fn custom_rings( self, range: impl Iterator<Item = u32>, start_dir: EdgeDirection, clockwise: bool, ) -> impl Iterator<Item = Vec<Hex>>
Retrieves range Hex rings around self in a given range.
The returned coordinates start from start_dir and loop around self
counter clockwise unless clockwise is set to true.
If you only need the coordinates see Self::spiral_range or
Self::rings.
§Example
let rings: Vec<Vec<Hex>> = Hex::ZERO
.custom_rings(3..10, EdgeDirection::FLAT_TOP, true)
.collect();
assert_eq!(rings.len(), 7);Sourcepub fn custom_ring_edge(
self,
radius: u32,
direction: VertexDirection,
clockwise: bool,
) -> impl ExactSizeIterator
pub fn custom_ring_edge( self, radius: u32, direction: VertexDirection, clockwise: bool, ) -> impl ExactSizeIterator
Retrieves one Hex ring edge around self in a given radius and
direction. The returned coordinates are sorted counter clockwise
unless clockwise is set to true.
If you only need the coordinates see Self::ring_edge.
§Note
The returned vector will be of radius + 1 length
Sourcepub fn ring_edge(
self,
radius: u32,
direction: VertexDirection,
) -> impl ExactSizeIterator
pub fn ring_edge( self, radius: u32, direction: VertexDirection, ) -> impl ExactSizeIterator
Retrieves one Hex ring edge around self in a given radius and
direction. The returned coordinates are sorted counter clockwise
around self.
See Self::custom_ring_edge for more options.
§Note
The returned vector will be of radius + 1 length
Sourcepub fn ring_edges(
self,
ranges: impl Iterator<Item = u32>,
direction: VertexDirection,
) -> impl Iterator<Item = impl ExactSizeIterator>
pub fn ring_edges( self, ranges: impl Iterator<Item = u32>, direction: VertexDirection, ) -> impl Iterator<Item = impl ExactSizeIterator>
Retrieves all successive Hex ring edges around self in given
ranges and direction.
The returned edges coordinates are sorted counter clockwise around
self.
§Example
let edges: Vec<_> = Hex::ZERO
.ring_edges(3..10, VertexDirection::FLAT_RIGHT)
.collect();
assert_eq!(edges.len(), 7);See also Self::custom_ring_edges
If you only need the coordinates see Self::custom_wedge
Sourcepub fn custom_ring_edges(
self,
ranges: impl Iterator<Item = u32>,
direction: VertexDirection,
clockwise: bool,
) -> impl Iterator<Item = impl ExactSizeIterator>
pub fn custom_ring_edges( self, ranges: impl Iterator<Item = u32>, direction: VertexDirection, clockwise: bool, ) -> impl Iterator<Item = impl ExactSizeIterator>
Retrieves all successive Hex ring edges around self in given
ranges and direction.
The returned edges coordinates are sorted counter clockwise around
self unless clockwise is set to true.
§Example
let edges: Vec<_> = Hex::ZERO
.custom_ring_edges(3..10, VertexDirection::FLAT_RIGHT, true)
.collect();
assert_eq!(edges.len(), 7);See also Self::ring_edges
If you only need the coordinates see Self::wedge
Sourcepub fn custom_wedge(
self,
ranges: impl Iterator<Item = u32>,
direction: VertexDirection,
clockwise: bool,
) -> impl Iterator<Item = Hex>
pub fn custom_wedge( self, ranges: impl Iterator<Item = u32>, direction: VertexDirection, clockwise: bool, ) -> impl Iterator<Item = Hex>
Retrieves all successive Hex ring edges around self in given
ranges and direction.
The returned edges coordinates are sorted counter clockwise around
self unless clockwise is set to true.
See also Self::custom_ring_edges
If you only need the coordinates see Self::wedge
If you want a full wedge see Self::custom_full_wedge
Sourcepub fn custom_wedge_to(
self,
rhs: Hex,
clockwise: bool,
) -> impl ExactSizeIterator
pub fn custom_wedge_to( self, rhs: Hex, clockwise: bool, ) -> impl ExactSizeIterator
Retrieves all successive Hex ring edges from self to rhs
The returned edges coordinates are sorted counter clockwise around
self unless clockwise is set to true.
See also Self::custom_ring_edges and Self::wedge_to
Sourcepub fn custom_full_wedge(
self,
range: u32,
direction: VertexDirection,
clockwise: bool,
) -> impl ExactSizeIterator
pub fn custom_full_wedge( self, range: u32, direction: VertexDirection, clockwise: bool, ) -> impl ExactSizeIterator
Retrieves all successive Hex ring edges around self in a given
range and direction The returned edges coordinates are sorted
counter clockwise around self unless clockwise is set to true.
See also Self::custom_wedge and Self::full_wedge
Sourcepub const fn wedge_count(range: u32) -> u32
pub const fn wedge_count(range: u32) -> u32
Counts how many coordinates there are in a wedge of given range
§Example
let point = Hex::new(3, -6);
let wedge: Vec<Hex> = point.wedge(0..=13, VertexDirection::FLAT_RIGHT).collect();
assert_eq!(wedge.len(), Hex::wedge_count(13) as usize);Sourcepub fn wedge(
self,
range: impl Iterator<Item = u32>,
direction: VertexDirection,
) -> impl Iterator<Item = Hex>
pub fn wedge( self, range: impl Iterator<Item = u32>, direction: VertexDirection, ) -> impl Iterator<Item = Hex>
Retrieves all successive Hex ring edges around self in a given
range and direction.
The returned edges coordinates are sorted counter clockwise around
self.
See also Self::custom_ring_edges and Self::custom_wedge
Sourcepub fn wedge_to(self, rhs: Hex) -> impl ExactSizeIterator
pub fn wedge_to(self, rhs: Hex) -> impl ExactSizeIterator
Retrieves all successive Hex ring edges from self to rhs
The returned edges coordinates are sorted counter clockwise.
See also Self::custom_ring_edges and Self::custom_wedge_to
Sourcepub fn full_wedge(
self,
range: u32,
direction: VertexDirection,
) -> impl ExactSizeIterator
pub fn full_wedge( self, range: u32, direction: VertexDirection, ) -> impl ExactSizeIterator
Retrieves all successive Hex ring edges around self in a given
range and direction The returned edges coordinates are sorted
counter clockwise around self.
See also Self::custom_full_wedge and Self::wedge
Sourcepub fn corner_wedge(
self,
range: impl Iterator<Item = u32>,
direction: EdgeDirection,
) -> impl Iterator<Item = Hex>
pub fn corner_wedge( self, range: impl Iterator<Item = u32>, direction: EdgeDirection, ) -> impl Iterator<Item = Hex>
Retrieves all successive Hex half ring edges around self in a
given range and direction.
See also Self::corner_wedge_to and Self::wedge
Sourcepub fn corner_wedge_to(self, rhs: Hex) -> impl Iterator<Item = Hex>
pub fn corner_wedge_to(self, rhs: Hex) -> impl Iterator<Item = Hex>
Retrieves all successive Hex half ring edges from self to rhs
See also Self::corner_wedge_to and Self::wedge_to
Sourcepub fn cached_custom_ring_edges<const RANGE: usize>(
self,
direction: VertexDirection,
clockwise: bool,
) -> [Vec<Hex>; RANGE]
pub fn cached_custom_ring_edges<const RANGE: usize>( self, direction: VertexDirection, clockwise: bool, ) -> [Vec<Hex>; RANGE]
Retrieves all successive Hex ring edges around self in a given
RANGE and direction as an array of edges.
The returned edges coordinates are sorted counter clockwise around
self unless clockwise is set to true.
See also Self::cached_ring_edges
If you only need the coordinates see Self::ring_edges or
Self::wedge.
§Usage
This function’s objective is to pre-compute edges around a coordinate, the returned array can be used as a cache to avoid extra computation.
§Example
// We cache 10 rings around the origin
let cache = Hex::ORIGIN.cached_custom_ring_edges::<10>(VertexDirection::FLAT_RIGHT, true);
// We have our target center
let target = Hex::new(11, 24);
// We retrieve the ring of range 5 and offset it to match the target
let five_ring = cache[5].iter().map(|h| *h + target);See this article for more information
Sourcepub fn cached_ring_edges<const RANGE: usize>(
self,
direction: VertexDirection,
) -> [Vec<Hex>; RANGE]
pub fn cached_ring_edges<const RANGE: usize>( self, direction: VertexDirection, ) -> [Vec<Hex>; RANGE]
Retrieves all successive Hex ring edges around self in a given
RANGE and direction as an array of edges.
The returned edges coordinates are sorted counter clockwise around
self.
See also Self::cached_custom_ring_edges
If you only need the coordinates see Self::ring_edges or
Self::wedge.
§Usage
This function’s objective is to pre-compute edges around a coordinate, the returned array can be used as a cache to avoid extra computation.
§Example
// We cache 10 rings around the origin
let cache = Hex::ORIGIN.cached_ring_edges::<10>(VertexDirection::FLAT_RIGHT);
// We have our target center
let target = Hex::new(11, 24);
// We retrieve the ring of range 5 and offset it to match the target
let five_ring = cache[5].iter().map(|h| *h + target);See this article for more information
Sourcepub fn cached_rings<const RANGE: usize>(self) -> [Vec<Hex>; RANGE]
pub fn cached_rings<const RANGE: usize>(self) -> [Vec<Hex>; RANGE]
Retrieves all successive Hex rings around self in a given RANGE
as an array of rings.
The returned rings start from EdgeDirection::default and loop
around self counter clockwise.
See also Self::cached_custom_rings
If you only need the coordinates see Self::range or
Self::spiral_range.
§Usage
This function’s objective is to pre-compute rings around a coordinate, the returned array can be used as a cache to avoid extra computation.
§Example
// We cache 10 rings around the origin
let cache = Hex::ORIGIN.cached_rings::<10>();
// We have our target center
let target = Hex::new(11, 24);
// We retrieve the ring of range 5 and offset it to match the target
let five_ring = cache[5].iter().map(|h| *h + target);See this article for more information
Sourcepub fn cached_custom_rings<const RANGE: usize>(
self,
start_dir: EdgeDirection,
clockwise: bool,
) -> [Vec<Hex>; RANGE]
pub fn cached_custom_rings<const RANGE: usize>( self, start_dir: EdgeDirection, clockwise: bool, ) -> [Vec<Hex>; RANGE]
Retrieves all successive Hex rings around self in a given RANGE
as an array of rings.
The returned rings start from start_dir] and loop around self
counter clockwise unless clockwise is set to true.
See also Self::cached_rings
If you only need the coordinates see Self::range or
Self::custom_spiral_range.
§Usage
This function’s objective is to pre-compute rings around a coordinate, the returned array can be used as a cache to avoid extra computation.
§Example
// We cache 10 rings around the origin
let cache = Hex::ORIGIN.cached_custom_rings::<10>(EdgeDirection::FLAT_TOP, true);
// We have our target center
let target = Hex::new(11, 24);
// We retrieve the ring of range 5 and offset it to match the target
let five_ring = cache[5].iter().map(|h| *h + target);See this article for more information
Sourcepub fn custom_spiral_range(
self,
range: impl Iterator<Item = u32>,
start_dir: EdgeDirection,
clockwise: bool,
) -> impl Iterator<Item = Hex>
pub fn custom_spiral_range( self, range: impl Iterator<Item = u32>, start_dir: EdgeDirection, clockwise: bool, ) -> impl Iterator<Item = Hex>
Retrieves all Hex around self in a given range but ordered as
successive rings, starting from start_dir and looping counter
clockwise unless clockwise is set to true, forming a spiral
If you only need the coordinates see Self::spiral_range.
See this article for more information
Sourcepub fn spiral_range(
self,
range: impl Iterator<Item = u32>,
) -> impl Iterator<Item = Hex>
pub fn spiral_range( self, range: impl Iterator<Item = u32>, ) -> impl Iterator<Item = Hex>
Retrieves all Hex around self in a given range but ordered as
successive rings, starting from EdgeDirection::FLAT_TOP_RIGHT and
looping counter clockwise, forming a spiral.
See Self::custom_spiral_range for more options
See this article for more information
Sourcepub const fn ring_count(range: u32) -> usize
pub const fn ring_count(range: u32) -> usize
Counts how many coordinates there are in a ring at the given range
Source§impl Hex
impl Hex
Source§impl Hex
impl Hex
Sourcepub const NEIGHBORS_COORDS: [Hex; 6]
pub const NEIGHBORS_COORDS: [Hex; 6]
Hexagon edge neighbor coordinates array, following EdgeDirection
order
Z ___ -Y
/ \
+--+ 4 +--+
/ 3 \___/ 5 \
\ / \ /
-X +--+ +--+ X
/ \___/ \
\ 2 / \ 0 /
+--+ 1 +--+
\___/
Y -ZCubic coordinates:
(0, -1, 1)
___
/ \
(-1, 0, 1) +--+ 4 +--+ (1, -1, 0)
/ 3 \___/ 5 \
\ / \ /
+--+ +--+
/ \___/ \
(-1, 1, 0) \ 2 / \ 0 / (1, 0, -1)
+--+ 1 +--+
\___/
(0, 1, -1)Sourcepub const DIAGONAL_COORDS: [Hex; 6]
pub const DIAGONAL_COORDS: [Hex; 6]
Hexagon diagonal neighbor coordinates array, following
VertexDirection order
Z -Y
\___/
\ 4 / \ 5 /
+--+ +--+
__/ \___/ \__
\ / \ /
-X 3 +--+ +--+ 0 X
__/ \___/ \__
\ / \ /
+--+ +--+
/ 2 \___/ 1 \
Y -ZSourcepub const fn new(x: i32, y: i32) -> Hex
pub const fn new(x: i32, y: i32) -> Hex
Instantiates a new hexagon from axial coordinates
§Example
let coord = Hex::new(3, 5);
assert_eq!(coord.x, 3);
assert_eq!(coord.y, 5);
assert_eq!(coord.z(), -3 - 5);Sourcepub const fn splat(v: i32) -> Hex
pub const fn splat(v: i32) -> Hex
Instantiates a new hexagon with all coordinates set to v
§Example
let coord = Hex::splat(3);
assert_eq!(coord.x, 3);
assert_eq!(coord.y, 3);
assert_eq!(coord.z(), -3 - 3);Sourcepub const fn z(self) -> i32
pub const fn z(self) -> i32
z coordinate (sometimes called s or k).
This cubic space coordinate is computed as -x - y
Sourcepub const fn from_array(_: [i32; 2]) -> Hex
pub const fn from_array(_: [i32; 2]) -> Hex
Sourcepub const fn to_array(self) -> [i32; 2]
pub const fn to_array(self) -> [i32; 2]
Converts self to an array as [x, y]
§Example
let coord = Hex::new(3, 5);
let [x, y] = coord.to_array();
assert_eq!(x, 3);
assert_eq!(y, 5);Sourcepub const fn to_array_f32(self) -> [f32; 2]
pub const fn to_array_f32(self) -> [f32; 2]
Converts self to an f32 array as [x, y]
Sourcepub const fn to_cubic_array(self) -> [i32; 3]
pub const fn to_cubic_array(self) -> [i32; 3]
Converts self to cubic coordinates array as [x, y, z]
§Example
let coord = Hex::new(3, 5);
let [x, y, z] = coord.to_cubic_array();
assert_eq!(x, 3);
assert_eq!(y, 5);
assert_eq!(z, -3 - 5);Sourcepub const fn to_cubic_array_f32(self) -> [f32; 3]
pub const fn to_cubic_array_f32(self) -> [f32; 3]
Converts self to cubic f32 coordinates array as [x, y, z]
Sourcepub const fn from_slice(slice: &[i32]) -> Hex
pub const fn from_slice(slice: &[i32]) -> Hex
Sourcepub fn write_to_slice(self, slice: &mut [i32])
pub fn write_to_slice(self, slice: &mut [i32])
Writes the elements of self to the first 2 elements in slice.
§Panics
Panics if slice is less than 2 elements long.
Sourcepub fn round(_: [f32; 2]) -> Hex
pub fn round(_: [f32; 2]) -> Hex
Rounds floating point coordinates to Hex.
This method is used for operations like multiplications and divisions
with floating point numbers.
See the original author Jacob Rus’s article for
more details
§Example
let point = [0.6, 10.2];
let coord = Hex::round(point);
assert_eq!(coord.x, 1);
assert_eq!(coord.y, 10);Sourcepub const fn abs(self) -> Hex
pub const fn abs(self) -> Hex
Computes the absolute value of self
§Example
let coord = Hex::new(-1, -32).abs();
assert_eq!(coord.x, 1);
assert_eq!(coord.y, 32);Sourcepub fn min(self, rhs: Hex) -> Hex
pub fn min(self, rhs: Hex) -> Hex
Returns a vector containing the minimum values for each element of
self and rhs.
In other words this computes [self.x.min(rhs.x), self.y.min(rhs.y), ..].
Sourcepub fn max(self, rhs: Hex) -> Hex
pub fn max(self, rhs: Hex) -> Hex
Returns a vector containing the maximum values for each element of
self and rhs.
In other words this computes [self.x.max(rhs.x), self.y.max(rhs.y), ..].
Sourcepub const fn signum(self) -> Hex
pub const fn signum(self) -> Hex
Returns a Hex with elements representing the sign of self.
0if the number is zero1if the number is positive-1if the number is negative
Sourcepub const fn length(self) -> i32
pub const fn length(self) -> i32
Computes coordinates length as a signed integer.
The length of a Hex coordinate is equal to its distance from the
origin.
See Self::ulength for the unsigned version
§Example
let coord = Hex::new(10, 0);
assert_eq!(coord.length(), 10);Sourcepub const fn ulength(self) -> u32
pub const fn ulength(self) -> u32
Computes coordinates length as an unsigned integer
The length of a Hex coordinate is equal to its distance from the
origin.
See Self::length for the signed version
§Example
let coord = Hex::new(10, 0);
assert_eq!(coord.ulength(), 10);Sourcepub const fn distance_to(self, rhs: Hex) -> i32
pub const fn distance_to(self, rhs: Hex) -> i32
Computes the distance from self to rhs in hexagonal space as a
signed integer
See Self::unsigned_distance_to for the unsigned version
Sourcepub const fn unsigned_distance_to(self, rhs: Hex) -> u32
pub const fn unsigned_distance_to(self, rhs: Hex) -> u32
Computes the distance from self to rhs in hexagonal space as an
unsigned integer
See Self::distance_to for the signed version
Sourcepub const fn neighbor_coord(direction: EdgeDirection) -> Hex
pub const fn neighbor_coord(direction: EdgeDirection) -> Hex
Retrieves the hexagonal neighbor coordinates matching the given
direction
Sourcepub const fn diagonal_neighbor_coord(direction: VertexDirection) -> Hex
pub const fn diagonal_neighbor_coord(direction: VertexDirection) -> Hex
Retrieves the diagonal neighbor coordinates matching the given
direction
Sourcepub const fn neighbor(self, direction: EdgeDirection) -> Hex
pub const fn neighbor(self, direction: EdgeDirection) -> Hex
Retrieves the neighbor coordinates matching the given direction
§Example
let coord = Hex::new(10, 5);
let bottom = coord.neighbor(EdgeDirection::FLAT_BOTTOM);
assert_eq!(bottom, Hex::new(10, 6));Sourcepub const fn diagonal_neighbor(self, direction: VertexDirection) -> Hex
pub const fn diagonal_neighbor(self, direction: VertexDirection) -> Hex
Retrieves the diagonal neighbor coordinates matching the given
direction
§Example
let coord = Hex::new(10, 5);
let bottom = coord.diagonal_neighbor(VertexDirection::FLAT_RIGHT);
assert_eq!(bottom, Hex::new(12, 4));Sourcepub fn neighbor_direction(self, other: Hex) -> Option<EdgeDirection>
pub fn neighbor_direction(self, other: Hex) -> Option<EdgeDirection>
Retrieves the direction of the given neighbor. Will return None if
other is not a neighbor of self
§Example
let coord = Hex::new(10, 5);
let bottom = coord.neighbor(EdgeDirection::FLAT_BOTTOM);
let dir = coord.neighbor_direction(bottom).unwrap();
assert_eq!(dir, EdgeDirection::FLAT_BOTTOM);Sourcepub fn main_diagonal_to(self, rhs: Hex) -> VertexDirection
pub fn main_diagonal_to(self, rhs: Hex) -> VertexDirection
Find in which VertexDirection wedge rhs is relative to self.
This method can be innaccurate in case of a tie between directions, prefer using
Self::diagonal_way_toinstead
Sourcepub fn diagonal_way_to(self, rhs: Hex) -> DirectionWay<VertexDirection>
pub fn diagonal_way_to(self, rhs: Hex) -> DirectionWay<VertexDirection>
Find in which VertexDirection wedge rhs is relative to self
Sourcepub fn main_direction_to(self, rhs: Hex) -> EdgeDirection
pub fn main_direction_to(self, rhs: Hex) -> EdgeDirection
Find in which EdgeDirection wedge rhs is relative to self
This method can be innaccurate in case of a tie between directions, prefer using
Self::way_tofor accuracy
Sourcepub fn way_to(self, rhs: Hex) -> DirectionWay<EdgeDirection>
pub fn way_to(self, rhs: Hex) -> DirectionWay<EdgeDirection>
Find in which EdgeDirection wedge rhs is relative to self
Sourcepub fn all_neighbors(self) -> [Hex; 6]
pub fn all_neighbors(self) -> [Hex; 6]
Retrieves all 6 neighbor coordinates around self
Sourcepub fn all_diagonals(self) -> [Hex; 6]
pub fn all_diagonals(self) -> [Hex; 6]
Retrieves all 6 neighbor diagonal coordinates around self
Sourcepub const fn counter_clockwise(self) -> Hex
pub const fn counter_clockwise(self) -> Hex
Sourcepub const fn ccw_around(self, center: Hex) -> Hex
pub const fn ccw_around(self, center: Hex) -> Hex
Rotates self around center counter clockwise (by -60 degrees)
Sourcepub const fn rotate_ccw(self, m: u32) -> Hex
pub const fn rotate_ccw(self, m: u32) -> Hex
Rotates self around Hex::ZERO counter clockwise by m (by -60 * m degrees)
Sourcepub const fn rotate_ccw_around(self, center: Hex, m: u32) -> Hex
pub const fn rotate_ccw_around(self, center: Hex, m: u32) -> Hex
Rotates self around center counter clockwise by m (by -60 * m
degrees)
Sourcepub const fn cw_around(self, center: Hex) -> Hex
pub const fn cw_around(self, center: Hex) -> Hex
Rotates self around center clockwise (by 60 degrees)
Sourcepub const fn rotate_cw(self, m: u32) -> Hex
pub const fn rotate_cw(self, m: u32) -> Hex
Rotates self around Hex::ZERO clockwise by m (by 60 * m
degrees)
Sourcepub const fn rotate_cw_around(self, center: Hex, m: u32) -> Hex
pub const fn rotate_cw_around(self, center: Hex, m: u32) -> Hex
Rotates self around center clockwise by m (by 60 * m degrees)
Sourcepub fn line_to(self, other: Hex) -> impl ExactSizeIterator
pub fn line_to(self, other: Hex) -> impl ExactSizeIterator
Computes all coordinates in a line from self to other.
§Example
let start = Hex::ZERO;
let end = Hex::new(5, 0);
let line = start.line_to(end);
assert_eq!(line.len(), 6);
let line: Vec<Hex> = line.collect();
assert_eq!(line.len(), 6);Sourcepub fn rectiline_to(self, other: Hex, clockwise: bool) -> impl ExactSizeIterator
pub fn rectiline_to(self, other: Hex, clockwise: bool) -> impl ExactSizeIterator
Computes all coordinate in a two segment rectiline path from self to
other
§Arguments
other- The destination coordinateclockwise- If set totruethe line paths will be clockwise
§Example
let start = Hex::ZERO;
let end = Hex::new(5, 0);
let line = start.rectiline_to(end, true);
assert_eq!(line.len(), 6);
let line: Vec<Hex> = line.collect();
assert_eq!(line.len(), 6);
assert_eq!(line[0], start);
assert_eq!(line[5], end);Sourcepub fn lerp(self, rhs: Hex, s: f32) -> Hex
pub fn lerp(self, rhs: Hex, s: f32) -> Hex
Performs a linear interpolation between self and rhs based on the
value s.
When s is 0.0, the result will be equal to self. When s is
1.0, the result will be equal to rhs. When s is outside of
range [0, 1], the result is linearly extrapolated.
Sourcepub fn range(self, range: u32) -> impl ExactSizeIterator
pub fn range(self, range: u32) -> impl ExactSizeIterator
Retrieves all Hex around self in a given range.
The number of returned coordinates is equal to Hex::range_count(range)
See also
Hex::xrangeto retrieve all coordinates excludingself
§Example
let coord = hex(12, 34);
assert_eq!(coord.range(0).len(), 1);
assert_eq!(coord.range(1).len(), 7);Sourcepub fn xrange(self, range: u32) -> impl ExactSizeIterator
pub fn xrange(self, range: u32) -> impl ExactSizeIterator
Retrieves all Hex around self in a given range except self.
The number of returned coordinates is equal to
Hex::range_count(range) - 1
See also
Hex::rangeto retrieve all coordinates includingself
§Example
let coord = hex(12, 34);
assert_eq!(coord.xrange(0).len(), 0);
assert_eq!(coord.xrange(1).len(), 6);Sourcepub fn to_lower_res(self, radius: u32) -> Hex
pub fn to_lower_res(self, radius: u32) -> Hex
Computes the coordinate of a lower resolution hexagon containing self
of a given radius.
The lower resolution coordinate can be considered parent of
the contained higher resolution coordinates.
The radius can be thought of as a chunk size, as if the grid was
split in hexagonal chunks of that radius. The returned value are the
coordinates of that chunk, in its own coordinates system.
See the source documentation for more information
See also
Self::to_higher_resandSelf::to_local
§Example
// We define a coordinate
let coord = hex(23, 45);
// We take its *parent* in a coordinate system of size 5
let parent = coord.to_lower_res(5);
// We can then retrieve the center of that parent in the same system as `coord`
let center = parent.to_higher_res(5);
// Therefore the distance between the parent center and `coord` should be lower than 5
assert!(coord.distance_to(center) <= 5);Sourcepub const fn to_higher_res(self, radius: u32) -> Hex
pub const fn to_higher_res(self, radius: u32) -> Hex
Computes the center coordinates of self in a higher resolution system
of a given radius.
The higher resolution coordinate can be considered as a child of
self as it is contained by it in a lower resolution coordinates
system. The radius can be thought of as a chunk size, as if the
grid was split in hexagonal chunks of that radius. The returned
value are the coordinates of the center that chunk, in a higher
resolution coordinates system.
See the source documentation for more information
See also
Self::to_lower_resandSelf::to_local
§Example
// We define a coordinate
let coord = hex(23, 45);
// We take its *parent* in a coordinate system of size 5
let parent = coord.to_lower_res(5);
// We can then retrieve the center of that parent in the same system as `coord`
let center = parent.to_higher_res(5);
// Therefore the distance between the parent center and `coord` should be lower than 5
assert!(coord.distance_to(center) <= 5);Sourcepub fn to_local(self, radius: u32) -> Hex
pub fn to_local(self, radius: u32) -> Hex
Computes the local coordinates of self in a lower resolution
coordinates system relative to its containing parent hexagon
See the source documentation for more information
See also
Self::to_lower_resandSelf::to_local
§Example
// We define a coordinate
let coord = hex(23, 45);
// We can then retrieve the center of that hexagon in a higher res of size 5
let center = coord.to_higher_res(5);
// Therefore, the local coordinates of `center` relative to `coord` should be zero
assert_eq!(center.to_local(5), Hex::ZERO);Sourcepub const fn range_count(range: u32) -> u32
pub const fn range_count(range: u32) -> u32
Counts how many coordinates there are in the given range
§Example
assert_eq!(Hex::range_count(15), 721);
assert_eq!(Hex::range_count(0), 1);Trait Implementations§
Source§impl Add<EdgeDirection> for Hex
impl Add<EdgeDirection> for Hex
Source§impl Add<VertexDirection> for Hex
impl Add<VertexDirection> for Hex
Source§impl AddAssign<EdgeDirection> for Hex
impl AddAssign<EdgeDirection> for Hex
Source§fn add_assign(&mut self, rhs: EdgeDirection)
fn add_assign(&mut self, rhs: EdgeDirection)
+= operation. Read moreSource§impl AddAssign<VertexDirection> for Hex
impl AddAssign<VertexDirection> for Hex
Source§fn add_assign(&mut self, rhs: VertexDirection)
fn add_assign(&mut self, rhs: VertexDirection)
+= operation. Read moreSource§impl AddAssign<i32> for Hex
impl AddAssign<i32> for Hex
Source§fn add_assign(&mut self, rhs: i32)
fn add_assign(&mut self, rhs: i32)
+= operation. Read moreSource§impl AddAssign for Hex
impl AddAssign for Hex
Source§fn add_assign(&mut self, rhs: Hex)
fn add_assign(&mut self, rhs: Hex)
+= operation. Read moreSource§impl<'de> Deserialize<'de> for Hex
impl<'de> Deserialize<'de> for Hex
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Hex, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Hex, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl DivAssign<f32> for Hex
impl DivAssign<f32> for Hex
Source§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
/= operation. Read moreSource§impl DivAssign<i32> for Hex
impl DivAssign<i32> for Hex
Source§fn div_assign(&mut self, rhs: i32)
fn div_assign(&mut self, rhs: i32)
/= operation. Read moreSource§impl DivAssign for Hex
impl DivAssign for Hex
Source§fn div_assign(&mut self, rhs: Hex)
fn div_assign(&mut self, rhs: Hex)
/= operation. Read moreSource§impl From<EdgeDirection> for Hex
impl From<EdgeDirection> for Hex
Source§fn from(value: EdgeDirection) -> Hex
fn from(value: EdgeDirection) -> Hex
Source§impl From<VertexDirection> for Hex
impl From<VertexDirection> for Hex
Source§fn from(value: VertexDirection) -> Hex
fn from(value: VertexDirection) -> Hex
Source§impl FromIterator<Hex> for Maze
impl FromIterator<Hex> for Maze
Source§impl FromReflect for Hex
impl FromReflect for Hex
Source§fn from_reflect(reflect: &(dyn PartialReflect + 'static)) -> Option<Hex>
fn from_reflect(reflect: &(dyn PartialReflect + 'static)) -> Option<Hex>
Self from a reflected value.Source§fn take_from_reflect(
reflect: Box<dyn PartialReflect>,
) -> Result<Self, Box<dyn PartialReflect>>
fn take_from_reflect( reflect: Box<dyn PartialReflect>, ) -> Result<Self, Box<dyn PartialReflect>>
Self using,
constructing the value using from_reflect if that fails. Read moreSource§impl GetTypeRegistration for Hex
impl GetTypeRegistration for Hex
Source§fn get_type_registration() -> TypeRegistration
fn get_type_registration() -> TypeRegistration
TypeRegistration for this type.Source§fn register_type_dependencies(registry: &mut TypeRegistry)
fn register_type_dependencies(registry: &mut TypeRegistry)
Source§impl MulAssign<f32> for Hex
impl MulAssign<f32> for Hex
Source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
*= operation. Read moreSource§impl MulAssign<i32> for Hex
impl MulAssign<i32> for Hex
Source§fn mul_assign(&mut self, rhs: i32)
fn mul_assign(&mut self, rhs: i32)
*= operation. Read moreSource§impl MulAssign for Hex
impl MulAssign for Hex
Source§fn mul_assign(&mut self, rhs: Hex)
fn mul_assign(&mut self, rhs: Hex)
*= operation. Read moreSource§impl PartialReflect for Hex
impl PartialReflect for Hex
Source§fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
Source§fn clone_value(&self) -> Box<dyn PartialReflect>
fn clone_value(&self) -> Box<dyn PartialReflect>
Reflect trait object. Read moreSource§fn try_apply(
&mut self,
value: &(dyn PartialReflect + 'static),
) -> Result<(), ApplyError>
fn try_apply( &mut self, value: &(dyn PartialReflect + 'static), ) -> Result<(), ApplyError>
Source§fn reflect_kind(&self) -> ReflectKind
fn reflect_kind(&self) -> ReflectKind
Source§fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
Source§fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
Source§fn reflect_owned(self: Box<Hex>) -> ReflectOwned
fn reflect_owned(self: Box<Hex>) -> ReflectOwned
Source§fn try_into_reflect(
self: Box<Hex>,
) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
fn try_into_reflect( self: Box<Hex>, ) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
Source§fn try_as_reflect(&self) -> Option<&(dyn Reflect + 'static)>
fn try_as_reflect(&self) -> Option<&(dyn Reflect + 'static)>
Source§fn try_as_reflect_mut(&mut self) -> Option<&mut (dyn Reflect + 'static)>
fn try_as_reflect_mut(&mut self) -> Option<&mut (dyn Reflect + 'static)>
Source§fn into_partial_reflect(self: Box<Hex>) -> Box<dyn PartialReflect>
fn into_partial_reflect(self: Box<Hex>) -> Box<dyn PartialReflect>
Source§fn as_partial_reflect(&self) -> &(dyn PartialReflect + 'static)
fn as_partial_reflect(&self) -> &(dyn PartialReflect + 'static)
Source§fn as_partial_reflect_mut(&mut self) -> &mut (dyn PartialReflect + 'static)
fn as_partial_reflect_mut(&mut self) -> &mut (dyn PartialReflect + 'static)
Source§fn reflect_partial_eq(
&self,
value: &(dyn PartialReflect + 'static),
) -> Option<bool>
fn reflect_partial_eq( &self, value: &(dyn PartialReflect + 'static), ) -> Option<bool>
Source§fn apply(&mut self, value: &(dyn PartialReflect + 'static))
fn apply(&mut self, value: &(dyn PartialReflect + 'static))
Source§fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
Source§fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Source§fn serializable(&self) -> Option<Serializable<'_>>
fn serializable(&self) -> Option<Serializable<'_>>
Source§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
Source§impl Reflect for Hex
impl Reflect for Hex
Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut dyn Any. Read moreSource§fn into_reflect(self: Box<Hex>) -> Box<dyn Reflect>
fn into_reflect(self: Box<Hex>) -> Box<dyn Reflect>
Source§fn as_reflect(&self) -> &(dyn Reflect + 'static)
fn as_reflect(&self) -> &(dyn Reflect + 'static)
Source§fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
Source§impl RemAssign<i32> for Hex
impl RemAssign<i32> for Hex
Source§fn rem_assign(&mut self, rhs: i32)
fn rem_assign(&mut self, rhs: i32)
%= operation. Read moreSource§impl RemAssign for Hex
impl RemAssign for Hex
Source§fn rem_assign(&mut self, rhs: Hex)
fn rem_assign(&mut self, rhs: Hex)
%= operation. Read moreSource§impl Serialize for Hex
impl Serialize for Hex
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl Struct for Hex
impl Struct for Hex
Source§fn field(&self, name: &str) -> Option<&(dyn PartialReflect + 'static)>
fn field(&self, name: &str) -> Option<&(dyn PartialReflect + 'static)>
name as a &dyn PartialReflect.Source§fn field_mut(
&mut self,
name: &str,
) -> Option<&mut (dyn PartialReflect + 'static)>
fn field_mut( &mut self, name: &str, ) -> Option<&mut (dyn PartialReflect + 'static)>
name as a
&mut dyn PartialReflect.Source§fn field_at(&self, index: usize) -> Option<&(dyn PartialReflect + 'static)>
fn field_at(&self, index: usize) -> Option<&(dyn PartialReflect + 'static)>
index as a
&dyn PartialReflect.Source§fn field_at_mut(
&mut self,
index: usize,
) -> Option<&mut (dyn PartialReflect + 'static)>
fn field_at_mut( &mut self, index: usize, ) -> Option<&mut (dyn PartialReflect + 'static)>
index
as a &mut dyn PartialReflect.Source§fn name_at(&self, index: usize) -> Option<&str>
fn name_at(&self, index: usize) -> Option<&str>
index.Source§fn iter_fields(&self) -> FieldIter<'_>
fn iter_fields(&self) -> FieldIter<'_>
Source§fn clone_dynamic(&self) -> DynamicStruct
fn clone_dynamic(&self) -> DynamicStruct
DynamicStruct.Source§fn get_represented_struct_info(&self) -> Option<&'static StructInfo>
fn get_represented_struct_info(&self) -> Option<&'static StructInfo>
None if TypeInfo is not available.Source§impl Sub<EdgeDirection> for Hex
impl Sub<EdgeDirection> for Hex
Source§impl Sub<VertexDirection> for Hex
impl Sub<VertexDirection> for Hex
Source§impl SubAssign<EdgeDirection> for Hex
impl SubAssign<EdgeDirection> for Hex
Source§fn sub_assign(&mut self, rhs: EdgeDirection)
fn sub_assign(&mut self, rhs: EdgeDirection)
-= operation. Read moreSource§impl SubAssign<VertexDirection> for Hex
impl SubAssign<VertexDirection> for Hex
Source§fn sub_assign(&mut self, rhs: VertexDirection)
fn sub_assign(&mut self, rhs: VertexDirection)
-= operation. Read moreSource§impl SubAssign<i32> for Hex
impl SubAssign<i32> for Hex
Source§fn sub_assign(&mut self, rhs: i32)
fn sub_assign(&mut self, rhs: i32)
-= operation. Read moreSource§impl SubAssign for Hex
impl SubAssign for Hex
Source§fn sub_assign(&mut self, rhs: Hex)
fn sub_assign(&mut self, rhs: Hex)
-= operation. Read moreSource§impl TypePath for Hex
impl TypePath for Hex
Source§fn type_path() -> &'static str
fn type_path() -> &'static str
Source§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
Source§fn type_ident() -> Option<&'static str>
fn type_ident() -> Option<&'static str>
Source§fn crate_name() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
impl Copy for Hex
impl Eq for Hex
impl StructuralPartialEq for Hex
Auto Trait Implementations§
impl Freeze for Hex
impl RefUnwindSafe for Hex
impl Send for Hex
impl Sync for Hex
impl Unpin for Hex
impl UnwindSafe for Hex
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DynamicTypePath for Twhere
T: TypePath,
impl<T> DynamicTypePath for Twhere
T: TypePath,
Source§fn reflect_type_path(&self) -> &str
fn reflect_type_path(&self) -> &str
TypePath::type_path.Source§fn reflect_short_type_path(&self) -> &str
fn reflect_short_type_path(&self) -> &str
Source§fn reflect_type_ident(&self) -> Option<&str>
fn reflect_type_ident(&self) -> Option<&str>
TypePath::type_ident.Source§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
TypePath::crate_name.Source§fn reflect_module_path(&self) -> Option<&str>
fn reflect_module_path(&self) -> Option<&str>
Source§impl<T> DynamicTyped for Twhere
T: Typed,
impl<T> DynamicTyped for Twhere
T: Typed,
Source§fn reflect_type_info(&self) -> &'static TypeInfo
fn reflect_type_info(&self) -> &'static TypeInfo
Typed::type_info.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<S> GetField for Swhere
S: Struct,
impl<S> GetField for Swhere
S: Struct,
Source§impl<T> GetPath for T
impl<T> GetPath for T
Source§fn reflect_path<'p>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>
fn reflect_path<'p>( &self, path: impl ReflectPath<'p>, ) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>
path. Read moreSource§fn reflect_path_mut<'p>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>
fn reflect_path_mut<'p>( &mut self, path: impl ReflectPath<'p>, ) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>
path. Read moreSource§fn path<'p, T>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
fn path<'p, T>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
path. Read moreSource§fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
path. Read moreSource§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more