Struct Array
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§
§impl Array
impl Array
pub fn with_capacity(capacity: usize) -> Array
pub fn with_capacity(capacity: usize) -> Array
Creates a new vec, with a known capacity.
pub fn first_mut(&mut self) -> Result<&mut Value, EcoString>
pub fn first_mut(&mut self) -> Result<&mut Value, EcoString>
Mutably borrow the first value in the array.
pub fn last_mut(&mut self) -> Result<&mut Value, EcoString>
pub fn last_mut(&mut self) -> Result<&mut Value, EcoString>
Mutably borrow the last value in the array.
pub fn at_mut(&mut self, index: i64) -> Result<&mut Value, EcoString>
pub fn at_mut(&mut self, index: i64) -> Result<&mut Value, EcoString>
Mutably borrow the value at the given index.
pub fn contains_impl(
&self,
value: &Value,
sink: &mut dyn DeprecationSink,
) -> bool
pub fn contains_impl( &self, value: &Value, sink: &mut dyn DeprecationSink, ) -> bool
The internal implementation of Array::contains
.
§impl Array
impl Array
pub fn construct(value: ToArray) -> Array
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))
pub fn first(&self) -> Result<Value, EcoString>
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.
pub fn last(&self) -> Result<Value, EcoString>
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.
pub fn at(&self, index: i64, default: Option<Value>) -> Result<Value, EcoString>
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.
pub fn pop(&mut self) -> Result<Value, EcoString>
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.
pub fn insert(&mut self, index: i64, value: Value) -> Result<(), EcoString>
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
.
pub fn remove(
&mut self,
index: i64,
default: Option<Value>,
) -> Result<Value, EcoString>
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.
pub fn slice(
&self,
start: i64,
end: Option<i64>,
count: Option<i64>,
) -> Result<Array, EcoString>
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.
pub fn contains(
&self,
engine: &mut Engine<'_>,
span: Span,
value: Value,
) -> bool
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)}
.
pub fn find(
&self,
engine: &mut Engine<'_>,
context: Tracked<'_, Context<'_>>,
searcher: Func,
) -> Result<Option<Value>, EcoVec<SourceDiagnostic>>
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.
pub fn position(
&self,
engine: &mut Engine<'_>,
context: Tracked<'_, Context<'_>>,
searcher: Func,
) -> Result<Option<i64>, EcoVec<SourceDiagnostic>>
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.
pub fn range(
args: &mut Args,
step: NonZero<i64>,
) -> Result<Array, EcoVec<SourceDiagnostic>>
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)
pub fn filter(
&self,
engine: &mut Engine<'_>,
context: Tracked<'_, Context<'_>>,
test: Func,
) -> Result<Array, EcoVec<SourceDiagnostic>>
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.
pub fn map(
self,
engine: &mut Engine<'_>,
context: Tracked<'_, Context<'_>>,
mapper: Func,
) -> Result<Array, EcoVec<SourceDiagnostic>>
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.
pub fn enumerate(self, start: i64) -> Result<Array, EcoString>
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.
pub fn zip(
self,
args: &mut Args,
exact: bool,
) -> Result<Array, EcoVec<SourceDiagnostic>>
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 i
th inner array contains all the
i
th 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))}
.
pub fn fold(
self,
engine: &mut Engine<'_>,
context: Tracked<'_, Context<'_>>,
init: Value,
folder: Func,
) -> Result<Value, EcoVec<SourceDiagnostic>>
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.
pub fn sum(
self,
engine: &mut Engine<'_>,
span: Span,
default: Option<Value>,
) -> Result<Value, HintedString>
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).
pub fn product(self, default: Option<Value>) -> Result<Value, HintedString>
pub fn product(self, default: Option<Value>) -> Result<Value, HintedString>
Calculates the product all items (works for all types that can be multiplied).
pub fn any(
self,
engine: &mut Engine<'_>,
context: Tracked<'_, Context<'_>>,
test: Func,
) -> Result<bool, EcoVec<SourceDiagnostic>>
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.
pub fn all(
self,
engine: &mut Engine<'_>,
context: Tracked<'_, Context<'_>>,
test: Func,
) -> Result<bool, EcoVec<SourceDiagnostic>>
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.
pub fn join(
self,
engine: &mut Engine<'_>,
span: Span,
separator: Option<Value>,
last: Option<Value>,
) -> Result<Value, EcoString>
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.
pub fn intersperse(self, separator: Value) -> Array
pub fn intersperse(self, separator: Value) -> Array
Returns an array with a copy of the separator value placed between adjacent elements.
pub fn chunks(self, chunk_size: NonZero<usize>, exact: bool) -> Array
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)
pub fn windows(self, window_size: NonZero<usize>) -> Array
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)
pub fn sorted(
self,
engine: &mut Engine<'_>,
context: Tracked<'_, Context<'_>>,
span: Span,
key: Option<Func>,
) -> Result<Array, EcoVec<SourceDiagnostic>>
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))
pub fn dedup(
self,
engine: &mut Engine<'_>,
context: Tracked<'_, Context<'_>>,
span: Span,
key: Option<Func>,
) -> Result<Array, EcoVec<SourceDiagnostic>>
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()
pub fn to_dict(self) -> Result<Dict, EcoString>
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()
pub fn reduce(
self,
engine: &mut Engine<'_>,
context: Tracked<'_, Context<'_>>,
reducer: Func,
) -> Result<Value, EcoVec<SourceDiagnostic>>
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§
§impl<'de> Deserialize<'de> for Array
impl<'de> Deserialize<'de> for Array
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Array, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Array, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Extend<Value> for Array
impl Extend<Value> for Array
§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = Value>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = Value>,
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)§impl FromIterator<Value> for Array
impl FromIterator<Value> for Array
§impl FromValue for Array
impl FromValue for Array
§fn from_value(value: Value) -> Result<Array, HintedString>
fn from_value(value: Value) -> Result<Array, HintedString>
Self
.§impl<'a> IntoIterator for &'a Array
impl<'a> IntoIterator for &'a Array
§impl IntoIterator for Array
impl IntoIterator for Array
§impl NativeScope for Array
impl NativeScope for Array
§fn constructor() -> Option<&'static NativeFuncData>
fn constructor() -> Option<&'static NativeFuncData>
§impl NativeType for Array
impl NativeType for Array
§impl Reflect for Array
impl Reflect for Array
§fn error(found: &Value) -> HintedString
fn error(found: &Value) -> HintedString
§impl Serialize for Array
impl Serialize for Array
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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 Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
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) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters
when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Filterable for T
impl<T> Filterable for T
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle
.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other
into Self
, while performing the appropriate scaling,
rounding and clamping.§impl<T> FromValue<Spanned<Value>> for Twhere
T: FromValue,
impl<T> FromValue<Spanned<Value>> for Twhere
T: FromValue,
§fn from_value(value: Spanned<Value>) -> Result<T, HintedString>
fn from_value(value: Spanned<Value>) -> Result<T, HintedString>
Self
.Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T
.§impl<I, T> IntoArgs for Iwhere
I: IntoIterator<Item = T>,
T: IntoValue,
impl<I, T> IntoArgs for Iwhere
I: IntoIterator<Item = T>,
T: IntoValue,
Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters
when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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§impl<T> IntoResult for Twhere
T: IntoValue,
impl<T> IntoResult for Twhere
T: IntoValue,
§fn into_result(self, _: Span) -> Result<Value, EcoVec<SourceDiagnostic>>
fn into_result(self, _: Span) -> Result<Value, EcoVec<SourceDiagnostic>>
Source§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self
into T
, while performing the appropriate scaling,
rounding and clamping.§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors
fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains
the unclamped color. Read more