Struct Array

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

A sequence of values.

You can construct an array by enclosing a comma-separated sequence of values in parentheses. The values do not have to be of the same type.

You can access and update array items with the .at() method. Indices are zero-based and negative indices wrap around to the end of the array. You can iterate over an array using a for loop. Arrays can be added together with the + operator, joined together and multiplied with integers.

Note: An array of length one needs a trailing comma, as in {(1,)}. This is to disambiguate from a simple parenthesized expressions like {(1 + 2) * 3}. An empty array is written as {()}.

§Example

#let values = (1, 7, 4, -3, 2)

#values.at(0) \
#(values.at(0) = 3)
#values.at(-1) \
#values.find(calc.even) \
#values.filter(calc.odd) \
#values.map(calc.abs) \
#values.rev() \
#(1, (2, 3)).flatten() \
#(("A", "B", "C")
    .join(", ", last: " and "))

Implementations§

Source§

impl Array

Source

pub fn new() -> Array

Create a new, empty array.

Source

pub fn with_capacity(capacity: usize) -> Array

Creates a new vec, with a known capacity.

Source

pub fn is_empty(&self) -> bool

Return true if the length is 0.

Source

pub fn as_slice(&self) -> &[Value]

Extract a slice of the whole array.

Source

pub fn iter(&self) -> Iter<'_, Value>

Iterate over references to the contained values.

Source

pub fn first_mut(&mut self) -> Result<&mut Value, EcoString>

Mutably borrow the first value in the array.

Source

pub fn last_mut(&mut self) -> Result<&mut Value, EcoString>

Mutably borrow the last value in the array.

Source

pub fn at_mut(&mut self, index: i64) -> Result<&mut Value, EcoString>

Mutably borrow the value at the given index.

Source

pub fn repeat(&self, n: usize) -> Result<Array, EcoString>

Repeat this array n times.

Source

pub fn contains_impl( &self, value: &Value, sink: &mut dyn DeprecationSink, ) -> bool

The internal implementation of Array::contains.

Source§

impl Array

Source

pub fn construct(value: ToArray) -> Array

Converts a value to an array.

Note that this function is only intended for conversion of a collection-like value to an array, not for creation of an array from individual items. Use the array syntax (1, 2, 3) (or (1,) for a single-element array) instead.

#let hi = "Hello 😃"
#array(bytes(hi))
Source

pub fn len(&self) -> usize

The number of values in the array.

Source

pub fn first(&self) -> Result<Value, EcoString>

Returns the first item in the array. May be used on the left-hand side of an assignment. Fails with an error if the array is empty.

Source

pub fn last(&self) -> Result<Value, EcoString>

Returns the last item in the array. May be used on the left-hand side of an assignment. Fails with an error if the array is empty.

Source

pub fn at(&self, index: i64, default: Option<Value>) -> Result<Value, EcoString>

Returns the item at the specified index in the array. May be used on the left-hand side of an assignment. Returns the default value if the index is out of bounds or fails with an error if no default value was specified.

Source

pub fn push(&mut self, value: Value)

Adds a value to the end of the array.

Source

pub fn pop(&mut self) -> Result<Value, EcoString>

Removes the last item from the array and returns it. Fails with an error if the array is empty.

Source

pub fn insert(&mut self, index: i64, value: Value) -> Result<(), EcoString>

Inserts a value into the array at the specified index, shifting all subsequent elements to the right. Fails with an error if the index is out of bounds.

To replace an element of an array, use at.

Source

pub fn remove( &mut self, index: i64, default: Option<Value>, ) -> Result<Value, EcoString>

Removes the value at the specified index from the array and return it.

Source

pub fn slice( &self, start: i64, end: Option<i64>, count: Option<i64>, ) -> Result<Array, EcoString>

Extracts a subslice of the array. Fails with an error if the start or end index is out of bounds.

Source

pub fn contains( &self, engine: &mut Engine<'_>, span: Span, value: Value, ) -> bool

Whether the array contains the specified value.

This method also has dedicated syntax: You can write {2 in (1, 2, 3)} instead of {(1, 2, 3).contains(2)}.

Source

pub fn find( &self, engine: &mut Engine<'_>, context: Tracked<'_, Context<'_>>, searcher: Func, ) -> Result<Option<Value>, EcoVec<SourceDiagnostic>>

Searches for an item for which the given function returns {true} and returns the first match or {none} if there is no match.

Source

pub fn position( &self, engine: &mut Engine<'_>, context: Tracked<'_, Context<'_>>, searcher: Func, ) -> Result<Option<i64>, EcoVec<SourceDiagnostic>>

Searches for an item for which the given function returns {true} and returns the index of the first match or {none} if there is no match.

Source

pub fn range( args: &mut Args, step: NonZero<i64>, ) -> Result<Array, EcoVec<SourceDiagnostic>>

Create an array consisting of a sequence of numbers.

If you pass just one positional parameter, it is interpreted as the end of the range. If you pass two, they describe the start and end of the range.

This function is available both in the array function’s scope and globally.

#range(5) \
#range(2, 5) \
#range(20, step: 4) \
#range(21, step: 4) \
#range(5, 2, step: -1)
Source

pub fn filter( &self, engine: &mut Engine<'_>, context: Tracked<'_, Context<'_>>, test: Func, ) -> Result<Array, EcoVec<SourceDiagnostic>>

Produces a new array with only the items from the original one for which the given function returns true.

Source

pub fn map( self, engine: &mut Engine<'_>, context: Tracked<'_, Context<'_>>, mapper: Func, ) -> Result<Array, EcoVec<SourceDiagnostic>>

Produces a new array in which all items from the original one were transformed with the given function.

Source

pub fn enumerate(self, start: i64) -> Result<Array, EcoString>

Returns a new array with the values alongside their indices.

The returned array consists of (index, value) pairs in the form of length-2 arrays. These can be destructured with a let binding or for loop.

Source

pub fn zip( self, args: &mut Args, exact: bool, ) -> Result<Array, EcoVec<SourceDiagnostic>>

Zips the array with other arrays.

Returns an array of arrays, where the ith inner array contains all the ith elements from each original array.

If the arrays to be zipped have different lengths, they are zipped up to the last element of the shortest array and all remaining elements are ignored.

This function is variadic, meaning that you can zip multiple arrays together at once: {(1, 2).zip(("A", "B"), (10, 20))} yields {((1, "A", 10), (2, "B", 20))}.

Source

pub fn fold( self, engine: &mut Engine<'_>, context: Tracked<'_, Context<'_>>, init: Value, folder: Func, ) -> Result<Value, EcoVec<SourceDiagnostic>>

Folds all items into a single value using an accumulator function.

Source

pub fn sum( self, engine: &mut Engine<'_>, span: Span, default: Option<Value>, ) -> Result<Value, HintedString>

Sums all items (works for all types that can be added).

Source

pub fn product(self, default: Option<Value>) -> Result<Value, HintedString>

Calculates the product all items (works for all types that can be multiplied).

Source

pub fn any( self, engine: &mut Engine<'_>, context: Tracked<'_, Context<'_>>, test: Func, ) -> Result<bool, EcoVec<SourceDiagnostic>>

Whether the given function returns {true} for any item in the array.

Source

pub fn all( self, engine: &mut Engine<'_>, context: Tracked<'_, Context<'_>>, test: Func, ) -> Result<bool, EcoVec<SourceDiagnostic>>

Whether the given function returns {true} for all items in the array.

Source

pub fn flatten(self) -> Array

Combine all nested arrays into a single flat one.

Source

pub fn rev(self) -> Array

Return a new array with the same items, but in reverse order.

Source

pub fn split(&self, at: Value) -> Array

Split the array at occurrences of the specified value.

Source

pub fn join( self, engine: &mut Engine<'_>, span: Span, separator: Option<Value>, last: Option<Value>, ) -> Result<Value, EcoString>

Combine all items in the array into one.

Source

pub fn intersperse(self, separator: Value) -> Array

Returns an array with a copy of the separator value placed between adjacent elements.

Source

pub fn chunks(self, chunk_size: NonZero<usize>, exact: bool) -> Array

Splits an array into non-overlapping chunks, starting at the beginning, ending with a single remainder chunk.

All chunks but the last have chunk-size elements. If exact is set to {true}, the remainder is dropped if it contains less than chunk-size elements.

#let array = (1, 2, 3, 4, 5, 6, 7, 8)
#array.chunks(3) \
#array.chunks(3, exact: true)
Source

pub fn windows(self, window_size: NonZero<usize>) -> Array

Returns sliding windows of window-size elements over an array.

If the array length is less than window-size, this will return an empty array.

#let array = (1, 2, 3, 4, 5, 6, 7, 8)
#array.windows(5)
Source

pub fn sorted( self, engine: &mut Engine<'_>, context: Tracked<'_, Context<'_>>, span: Span, key: Option<Func>, ) -> Result<Array, EcoVec<SourceDiagnostic>>

Return a sorted version of this array, optionally by a given key function. The sorting algorithm used is stable.

Returns an error if two values could not be compared or if the key function (if given) yields an error.

To sort according to multiple criteria at once, e.g. in case of equality between some criteria, the key function can return an array. The results are in lexicographic order.

#let array = (
  (a: 2, b: 4),
  (a: 1, b: 5),
  (a: 2, b: 3),
)
#array.sorted(key: it => (it.a, it.b))
Source

pub fn dedup( self, engine: &mut Engine<'_>, context: Tracked<'_, Context<'_>>, span: Span, key: Option<Func>, ) -> Result<Array, EcoVec<SourceDiagnostic>>

Deduplicates all items in the array.

Returns a new array with all duplicate items removed. Only the first element of each duplicate is kept.

#(1, 1, 2, 3, 1).dedup()
Source

pub fn to_dict(self) -> Result<Dict, EcoString>

Converts an array of pairs into a dictionary. The first value of each pair is the key, the second the value.

If the same key occurs multiple times, the last value is selected.

#(
  ("apples", 2),
  ("peaches", 3),
  ("apples", 5),
).to-dict()
Source

pub fn reduce( self, engine: &mut Engine<'_>, context: Tracked<'_, Context<'_>>, reducer: Func, ) -> Result<Value, EcoVec<SourceDiagnostic>>

Reduces the elements to a single one, by repeatedly applying a reducing operation.

If the array is empty, returns {none}, otherwise, returns the result of the reduction.

The reducing function is a closure with two arguments: an “accumulator”, and an element.

For arrays with at least one element, this is the same as [array.fold] with the first element of the array as the initial accumulator value, folding every subsequent element into it.

Trait Implementations§

Source§

impl Add for Array

Source§

type Output = Array

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Array) -> <Array as Add>::Output

Performs the + operation. Read more
Source§

impl AddAssign for Array

Source§

fn add_assign(&mut self, rhs: Array)

Performs the += operation. Read more
Source§

impl Clone for Array

Source§

fn clone(&self) -> Array

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Array

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Array

Source§

fn default() -> Array

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

impl<'de> Deserialize<'de> for Array

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Array, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Extend<Value> for Array

Source§

fn extend<T>(&mut self, iter: T)
where T: IntoIterator<Item = Value>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl From<&[Value]> for Array

Source§

fn from(v: &[Value]) -> Array

Converts to this type from the input type.
Source§

impl From<EcoVec<Value>> for Array

Source§

fn from(v: EcoVec<Value>) -> Array

Converts to this type from the input type.
Source§

impl FromIterator<Value> for Array

Source§

fn from_iter<T>(iter: T) -> Array
where T: IntoIterator<Item = Value>,

Creates a value from an iterator. Read more
Source§

impl FromValue for Array

Source§

fn from_value(value: Value) -> Result<Array, HintedString>

Try to cast the value into an instance of Self.
Source§

impl Hash for Array

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

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

impl<'a> IntoIterator for &'a Array

Source§

type Item = &'a Value

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, Value>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <&'a Array as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl IntoIterator for Array

Source§

type Item = Value

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<Value>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <Array as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl IntoValue for Array

Source§

fn into_value(self) -> Value

Cast this type into a value.
Source§

impl NativeScope for Array

Source§

fn constructor() -> Option<&'static NativeFuncData>

The constructor function for the type, if any.
Source§

fn scope() -> Scope

Get the associated scope for the type.
Source§

impl NativeType for Array

Source§

const NAME: &'static str = "array"

The type’s name. Read more
Source§

fn data() -> &'static NativeTypeData

Source§

fn ty() -> Type

Get the type for the native Rust type.
Source§

impl PartialEq for Array

Source§

fn eq(&self, other: &Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Reflect for Array

Source§

fn input() -> CastInfo

Describe what can be cast into this value.
Source§

fn output() -> CastInfo

Describe what this value can be cast into.
Source§

fn castable(value: &Value) -> bool

Whether the given value can be converted to T. Read more
Source§

fn error(found: &Value) -> HintedString

Produce an error message for an unacceptable value type. Read more
Source§

impl Repr for Array

Source§

fn repr(&self) -> EcoString

Return the debug representation of the value.
Source§

impl Serialize for Array

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Array

Auto Trait Implementations§

§

impl Freeze for Array

§

impl !RefUnwindSafe for Array

§

impl Send for Array

§

impl Sync for Array

§

impl Unpin for Array

§

impl !UnwindSafe for Array

Blanket Implementations§

Source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where T: Real + Zero + Arithmetics + Clone, Swp: WhitePoint<T>, Dwp: WhitePoint<T>, D: AdaptFrom<S, Swp, Dwp, T>,

Source§

fn adapt_into_using<M>(self, method: M) -> D
where M: TransformMatrix<T>,

Convert the source color to the destination color using the specified method.
Source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default.
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<S, T> ArcInto<T> for S
where Arc<S>: Into<T>,

Source§

fn arc_into(self: Arc<S>) -> T

Converts Arc<T> into Self.
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T, C> ArraysFrom<C> for T
where C: IntoArrays<T>,

Source§

fn arrays_from(colors: C) -> T

Cast a collection of colors into a collection of arrays.
Source§

impl<T, C> ArraysInto<C> for T
where C: FromArrays<T>,

Source§

fn arrays_into(self) -> C

Cast this collection of arrays into a collection of colors.
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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> CallHasher for T
where T: Hash + ?Sized,

Source§

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64
where H: Hash + ?Sized, B: BuildHasher,

Source§

impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for U
where T: FromCam16Unclamped<WpParam, U>,

Source§

type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T, C> ComponentsFrom<C> for T
where C: IntoComponents<T>,

Source§

fn components_from(colors: C) -> T

Cast a collection of colors into a collection of color components.
Source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> Filterable for T

Source§

fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromAngle<T> for T

Source§

fn from_angle(angle: T) -> T

Performs a conversion from angle.
Source§

impl<T, U> FromStimulus<U> for T
where U: IntoStimulus<T>,

Source§

fn from_stimulus(other: U) -> T

Converts other into Self, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T> FromValue<Spanned<Value>> for T
where T: FromValue,

Source§

fn from_value(value: Spanned<Value>) -> Result<T, HintedString>

Try to cast the value into an instance of Self.
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> IntoAngle<U> for T
where U: FromAngle<T>,

Source§

fn into_angle(self) -> U

Performs a conversion into T.
Source§

impl<I, T> IntoArgs for I
where I: IntoIterator<Item = T>, T: IntoValue,

Source§

fn into_args(self, fallback: Span) -> Args

Convert into arguments, attaching the fallback span in case Self doesn’t have a span.
Source§

impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for U
where T: Cam16FromUnclamped<WpParam, U>,

Source§

type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,

Source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
Source§

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

Source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoResult for T
where T: IntoValue,

Source§

fn into_result(self, _: Span) -> Result<Value, EcoVec<SourceDiagnostic>>

Cast this type into a value.
Source§

impl<T> IntoStimulus<T> for T

Source§

fn into_stimulus(self) -> T

Converts self into T, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, C> TryComponentsInto<C> for T
where C: TryFromComponents<T>,

Source§

type Error = <C as TryFromComponents<T>>::Error

The error for when try_into_colors fails to cast.
Source§

fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>

Try to cast this collection of color components into a collection of colors. Read more
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.
Source§

impl<T, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

Source§

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more
Source§

impl<C, U> UintsFrom<C> for U
where C: IntoUints<U>,

Source§

fn uints_from(colors: C) -> U

Cast a collection of colors into a collection of unsigned integers.
Source§

impl<C, U> UintsInto<C> for U
where C: FromUints<U>,

Source§

fn uints_into(self) -> C

Cast this collection of unsigned integers into a collection of colors.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T
where T: Send + Sync,