Struct screeps::pathfinder::LocalCostMatrix [] [src]

pub struct LocalCostMatrix { /* fields omitted */ }

Methods

impl LocalCostMatrix
[src]

[src]

[src]

[src]

[src]

Copies all data into an JavaScript CostMatrix for use.

This is slower than as_uploaded, but much safer.

[src]

Temporarily exposes the bits of this matrix as a cost matrix.

Unsafety

There are two main invariants you must uphold after using this function:

  1. The CostMatrix can only be used in JS code as long as this LocalCostMatrix is alive. Doing otherwise will result in undefined behavior, mainly JS being allowed to read/ manipulate uninitialized rust memory or rust memory that's been repurposed.

  2. The set method of the cost matrix must not be used - it must be read only. This takes &self, but technically allows mutation of the inner Vec via JavaScript access. You should not use this method, or you will invoke Rust undefined behavior.

The CostMatrix returned will reference the internal data of this LocalCostMatrix.

Trait Implementations

impl Serialize for LocalCostMatrix
[src]

[src]

Serialize this value into the given Serde serializer. Read more

impl<'de> Deserialize<'de> for LocalCostMatrix
[src]

[src]

Deserialize this value from the given Serde deserializer. Read more

impl Clone for LocalCostMatrix
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for LocalCostMatrix
[src]

[src]

Formats the value using the given formatter. Read more

impl Into<Vec<u8>> for LocalCostMatrix
[src]

[src]

Returns a vector of bits length 2500, where each position is idx = ((x * 50) + y).

Auto Trait Implementations