# Spaces in maplibre::style - Rust
An enum with a variant for each of the color spaces supported by the library. Useful for tracking as metadata in something like an image type, and for runtime-determined color types.

# Enum maplibre::style::Spaces

    #[repr(u32)]pub enum Spaces {
    Show 36 variants    EncodedSrgb = 0,
        LinearSrgb = 1,
        EncodedRec709 = 2,
        Rec709 = 3,
        GenericColor3 = 4,
        GenericColor1 = 5,
        Luminance = 6,
        Luma = 7,
        AcesCg = 8,
        Aces2065 = 9,
        AcesCc = 10,
        AcesCct = 11,
        DisplayP3 = 12,
        EncodedDisplayP3 = 13,
        DciP3 = 14,
        DciXYZPrime = 15,
        Bt2020 = 16,
        EncodedBt2020 = 17,
        Bt2100 = 18,
        EncodedBt2100PQ = 19,
        EncodedBt2100HLG = 20,
        ICtCpPQ = 21,
        ICtCpHLG = 22,
        CieXYZ = 23,
        CieLab = 24,
        CieLCh = 25,
        Oklab = 26,
        Oklch = 27,
        Hsl = 28,
        Hsv = 29,
        YCbCr = 30,
        YPrimeCbCr = 31,
        YPbPr = 32,
        YPrimePbPr = 33,
        Yuv = 34,
        YCxCz = 35,
    }

Expand description

An enum with a variant for each of the color spaces supported by the library. Useful for tracking as metadata in something like an image type, and for runtime-determined color types.

## Variants§

§

### EncodedSrgb = 0

A color in the encoded sRGB color space.

This color space uses the sRGB/Rec.709 primaries, D65 white point, and sRGB transfer functions. The encoded version is nonlinear, with the sRGB OETF, aka “gamma compensation”, applied.

§

### LinearSrgb = 1

A color in the linear (decoded) sRGB color space.

This color space uses the sRGB/Rec.709 primaries, D65 white point, and sRGB transfer functions. This version is linear, with the sRGB EOTF, aka “inverse gamma compensation”, applied in order to decode it from `EncodedSrgb`

§

### EncodedRec709 = 2

A color in the encoded Rec.709/BT.709 color space.

This color space uses the BT.709 primaries, D65 white point, and BT.601 (reused in BT.709) transfer function. The encoded version is nonlinear, with the BT.601 OETF applied.

§

### Rec709 = 3

A color in the Rec.709/BT.709 color space.

This color space uses the BT.709 primaries, D65 white point, and BT.601 (reused in BT.709) transfer function. This version is linear, without the BT.601 OETF applied.

§

### GenericColor3 = 4

A color in a generic color space that can be represented by 3 components. The user is responsible for ensuring that the correct color space is respected.

§

### GenericColor1 = 5

A color in a generic color space that can be represented by 1 component. The user is responsible for ensuring that the correct color space is respected.

§

### Luminance = 6

A single-channel CIE luminance.

§

### Luma = 7

A single-channel CIE luma (non-linear transform from luminance).

§

### AcesCg = 8

A color in the ACEScg color space.

This color space uses the ACES AP1 primaries and D60 white point.

§

### Aces2065 = 9

A color in the ACES 2065-1 color space.

This color space uses the ACES AP0 primaries and D60 white point.

§

### AcesCc = 10

A color in the ACEScc color space.

This color space uses the ACES AP1 primaries and D60 white point and a pure logarithmic transfer function.

§

### AcesCct = 11

A color in the ACEScct color space.

This color space uses the ACES AP1 primaries and D60 white point and a logarithmic transfer function with a toe such that values are able to go negative.

§

### DisplayP3 = 12

A color in the Display P3 (aka P3 D65) color space.

This color space uses the P3 primaries and D65 white point and sRGB transfer functions. This version is linear, without the sRGB OETF applied.

§

### EncodedDisplayP3 = 13

A color in the Display P3 (aka P3 D65) color space.

This color space uses the P3 primaries and D65 white point and sRGB transfer functions. This encoded version is nonlinear, with the sRGB OETF applied.

§

### DciP3 = 14

A color in the DCI-P3 (aka P3 DCI and P3 D60) color space.

If you are looking for the P3 which is used on new Apple displays, see `DisplayP3` instead.

This color space uses the P3 primaries and D60 white point.

§

### DciXYZPrime = 15

A color in the X’Y’Z’ color space, a DCI specification used for digital cinema mastering.

This color space uses the CIE XYZ primaries, with special DCI white point and pure 2.6 gamma encoding.

§

### Bt2020 = 16

A color in the BT.2020 color space.

This color space uses the BT.2020 primaries and D65 white point.

§

### EncodedBt2020 = 17

A color in the encoded BT.2020 color space.

This color space uses the BT.2020 primaries and D65 white point and the BT.2020 transfer functions (equivalent to BT.601 transfer functions but with higher precision). This encoded version is nonlinear, with the BT.2020/BT.601 OETF applied.

§

### Bt2100 = 18

A color in the BT.2100 color space.

This color space uses the BT.2020 primaries and D65 white point.

§

### EncodedBt2100PQ = 19

A color in the encoded BT.2100 color space with PQ (Perceptual Quantizer) transfer function.

This color space uses the BT.2020 primaries and D65 white point and the ST 2084/“PQ” transfer function. It is nonlinear.

§

### EncodedBt2100HLG = 20

A color in the encoded BT.2100 color space with HLG (Hybrid Log-Gamma) transfer function.

This color space uses the BT.2020 primaries and D65 white point and the HLG transfer function. It is nonlinear.

§

### ICtCpPQ = 21

A color in the ICtCp color space with PQ (Perceptual Quantizer) nonlinearity.

This color space is based on the BT.2020 primaries and D65 white point, but is not an RGB color space. Instead it is a roughly perceptual color space meant to more efficiently encode HDR content.

§

### ICtCpHLG = 22

A color in the ICtCp color space with HLG (Hybrid Log-Gamma) nonlinearity.

This color space is based on the BT.2020 primaries and D65 white point, but is not an RGB color space. Instead it is a roughly perceptual color space meant to more efficiently encode HDR content.

§

### CieXYZ = 23

A color in the CIE XYZ color space.

This color space uses the CIE XYZ primaries and D65 white point.

§

### CieLab = 24

A color in the CIE L*a*b* color space.

§

### CieLCh = 25

A color in the CIE L*C*h° color space.

§

### Oklab = 26

A color in the Oklab color space.

§

### Oklch = 27

A color in the Oklch color space (a transformation from Oklab to LCh° coordinates).

§

### Hsl = 28

A color in the HSL color space.

Since HSL is a relative color space, it is required to know the RGB space which it was transformed from. We define this as the linear sRGB space, as that is the most common case.

§

### Hsv = 29

A color in the HSV color space.

Since HSV is a relative color space, it is required to know the RGB space which it was transformed from. We define this as the linear sRGB space, as that is the most common case.

§

### YCbCr = 30

A color in the YCbCr color space. See discussion of the difference between YCbCr, YUV, and YPbPr in YCbCr Wikipedia article

Since YCbCr is a relative color space, it is required to know the RGB space which it was transformed from. We define this as being converted from the LinearSrgb color space.

§

### YPrimeCbCr = 31

A color in the Y’CbCr color space. See discussion of the difference between YCbCr, Y’CbCr, YUV, YPbPr, and Y’PbPr in the YCbCr Wikipedia article

Since Y’CbCr is a relative color space, it is required to know the RGB space which it was transformed from. We define this as being converted from the EncodedSrgb color space.

§

### YPbPr = 32

A color in the YPbPr color space. See discussion of the difference between YCbCr, YUV, YPbPr, and Y’PbPr in the YCbCr Wikipedia article

Since YPbPr is a relative color space, it is required to know the RGB space which it was transformed from. We define this as being converted from the LinearSrgb color space.

§

### YPrimePbPr = 33

A color in the Y’PbPr color space. See discussion of the difference between YCbCr, YUV, YPbPr, and Y’PbPr in the YCbCr Wikipedia article

Since Y’PbPr is a relative color space, it is required to know the RGB space which it was transformed from. We define this as being converted from the EncodedSrgb color space.

§

### Yuv = 34

A color in the YUV color space. See discussion of the difference between YCbCr, YUV, and YPbPr in YCbCr Wikipedia article

§

### YCxCz = 35

A color in the YCxCz (also called YyCxCz) color space, originally defined in “Optimized universal color palette design for error diffusion” by B. W. Kolpatzik and C. A. Bouman. Can be thought of as a “linear CIE Lab”.

## Implementations§

§

### impl Spaces

#### pub fn num_components(&self) -> usize

## Trait Implementations§

§

### impl Clone for Spaces

§

#### fn clone(&self) -> Spaces

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
§

### impl Debug for Spaces

§

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

Formats the value using the given formatter. Read more
§

### impl Hash for Spaces

§

#### 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
§

### impl PartialEq for Spaces

§

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

This method tests for `self` and `other` values to be equal, and is used by `==`.
1.0.0 · source §

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

This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

### impl Copy for Spaces

§

### impl Eq for Spaces

§

### impl StructuralEq for Spaces

§

### impl StructuralPartialEq for Spaces

## Auto Trait Implementations§

§

### impl RefUnwindSafe for Spaces

§

### impl Send for Spaces

§

### impl Sync for Spaces

§

### impl Unpin for Spaces

§

### impl UnwindSafe for Spaces

## 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
§

### impl<T> Downcast<T> for T

§

#### fn downcast(&self) -> &T

§

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

§

#### 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`.
§

#### 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`.
§

#### 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.
§

#### 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.
§

### impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

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

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> DynEq for T
where T: Any + Eq,

source §

#### fn as_any(&self) -> &(dyn Any + 'static)

source §

#### fn dyn_eq(&self, other: &(dyn DynEq + 'static)) -> bool

source §

### impl<T> DynHash for T
where T: DynEq + Hash,

source §

#### fn as_dyn_eq(&self) -> &(dyn DynEq + 'static)

source §

#### fn dyn_hash(&self, state: &mut dyn Hasher)

§

### impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

#### fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

### impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

#### fn equivalent(&self, key: &K) -> bool

Compare self to `key` and return `true` if they are equal.
source §

### impl<T> From<T> for T

source §

#### fn from(t: T) -> T

Returns the argument unchanged.

§

### impl<T> Instrument for T

§

#### fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [`Span`], returning an `Instrumented` wrapper. Read more
§

#### fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current `Span`, returning an `Instrumented` wrapper. Read more
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> Same for T

§

#### type Output = T

Should always be `Self`
source §

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

§

#### 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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

#### 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.
§

### impl<T> Upcast<T> for T

§

#### fn upcast(&self) -> Option<&T>

§

### impl<T> WithSubscriber for T

§

#### fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided `Subscriber` to this type, returning a [`WithDispatch`] wrapper. Read more
§

#### fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default `Subscriber` to this type, returning a [`WithDispatch`] wrapper. Read more
§

### impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

§

#### fn is_within(&self, b: &G2) -> bool

source §

### impl<T> Resource for T
where T: 'static,

§

### impl<T> WasmNotSend for T
where T: Send,

§

### impl<T> WasmNotSync for T
where T: Sync,