pub struct LocalCostMatrix { /* private fields */ }

Implementations

Copies all data into an JavaScript CostMatrix for use.

This is slower than as_uploaded, but much safer.

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

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more

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

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Casts this value as the target type, making the assumption that the types are correct. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.