Struct ColorArray

Source
pub struct ColorArray(/* private fields */);
Expand description

A reference-counted vector of ColorArray that uses Godot’s pool allocator.

Implementations§

Source§

impl ColorArray

Source

pub fn new() -> ColorArray

Creates an empty ColorArray.

Source

pub fn from_variant_array(array: &VariantArray) -> ColorArray

Creates an array by trying to convert each variant.

See Variant::to_color_array.

Source

pub fn push(&mut self, color: &Color)

Appends an element at the end of the array

Source

pub fn push_array(&mut self, array: &ColorArray)

Appends a ColorArray at the end of this array.

Source

pub fn insert(&mut self, offset: i32, color: &Color) -> bool

Insert a new int at a given position in the array.

Source

pub fn invert(&mut self)

Inverts the order of the elements in the array.

Source

pub fn remove(&mut self, idx: i32)

Removes an element at the given offset.

Source

pub fn resize(&mut self, size: i32)

Changes the size of the array, possibly removing elements or pushing default values.

Source

pub fn get(&self, idx: i32) -> Color

Returns a copy of the element at the given offset.

Source

pub fn set(&mut self, idx: i32, color: &Color)

Sets the value of the element at the given offset.

Source

pub fn len(&self) -> i32

Returns the number of elements in the array.

Source

pub fn new_ref(&self) -> ColorArray

Trait Implementations§

Source§

impl Default for ColorArray

Source§

fn default() -> ColorArray

Returns the “default value” for a type. Read more
Source§

impl Drop for ColorArray

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'l> From<&'l ColorArray> for Variant

Source§

fn from(val: &'l ColorArray) -> Variant

Converts to this type from the input type.
Source§

impl ToVariant for ColorArray

Auto Trait Implementations§

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> 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, 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.