pub struct Vector3<T> {
    pub x: T,
    pub y: T,
    pub z: T,
}
Expand description

Vector Struct for representing a three-dimensional value.

Fields

x: T

Represents the first dimensional value.

y: T

Represents the second dimensional value.

z: T

Represents the third dimensional value.

Implementations

Name of the Vector Struct as a static str.

Size of the Vector in Bytes, calculated based of size_of::<T>() * Vector::LEN.

Number of fields in the Vector Struct as a usize.

Creates a new Vector with the specified values for the fields.

Example
let vector = Vector2::new("Vector", "2");
assert_eq!(vector.x, "Vector");
assert_eq!(vector.y, "2");

Returns the maximum value contained within the Vector.

Example
let vector = Vector3::new(1, 0, 2);
assert_eq!(vector.max(), 2);

Returns the minimum value contained within the Vector.

Example
let vector = Vector3::new(1, 0, 2);
assert_eq!(vector.min(), 0);

Trait Implementations

The resulting type after applying the + operator.

Performs the + operation. Read more

Performs the += operation. Read more

The resulting type after applying the & operator.

Performs the & operation. Read more

Performs the &= operation. Read more

The resulting type after applying the | operator.

Performs the | operation. Read more

Performs the |= operation. Read more

The resulting type after applying the ^ operator.

Performs the ^ operation. Read more

Performs the ^= operation. Read more

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

Formats the value using the given formatter. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

Performs the /= operation. Read more

Converts all numbers within the FloatingPointVector to zero. Read more

Converts all numbers within the FloatingPointVector to the largest integer less than or equal to the value. Read more

Converts all numbers within the FloatingPointVector to the largest integer greater than or equal to the value. Read more

Converts all numbers within the FloatingPointVector to the nearest integer. Read more

Converts all numbers within the FloatingPointVector to their absolute value. Read more

Raises all numbers within the FloatingPointVector to an integer power. Read more

Raises all numbers within the FloatingPointVector to a floating point power. Read more

Sets all numbers within the FloatingPointVector to their integer parts. Read more

Sets all numbers within the FloatingPointVector to their fractional parts. Read more

Sets all numbers within the FloatingPointVector to their square-root. Read more

Linearly interpolates between two FloatingPointVectors by a normalized weight. Read more

Returns the dot product of two FloatingPointVectors, this can be used to compare the angle between two FloatingPointVectors. Read more

Returns the squared magnitude of the FloatingPointVector. This will always run faster than [length], this method should prefered over it if applicable. Read more

Returns the magnitude of the FloatingPointVector. Read more

Returns a normalized FloatingPointVector pointing from it to to. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

Raises all numbers within the IntegerVector to the specified power. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

Performs the *= operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The resulting type after applying the % operator.

Performs the % operation. Read more

Performs the %= operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

Performs the -= operation. Read more

The type returned in the event of a conversion error.

Performs the conversion.

Converts the TuplableVector into a tuple representing its values. Read more

Returns the name of the Vector struct. Read more

Converts the given Vector into an array coresponding to the size of the Vector. Read more

Converts the given Vector into a Vec coresponding to the size of the Vector. Read more

Returns the size of the Vector struct in bytes. Read more

Returns the number of fields in the Vector struct. 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.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. 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.