1use crate::{UiPosition, Val, ValNum};
2use bevy_color::{Color, Srgba};
3use bevy_ecs::{component::Component, reflect::ReflectComponent};
4use bevy_math::Vec2;
5use bevy_reflect::prelude::*;
6use bevy_utils::default;
7use core::{f32, f32::consts::TAU};
8
9#[derive(#[automatically_derived]
impl ::core::fmt::Debug for ColorStop {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f, "ColorStop",
"color", &self.color, "point", &self.point, "hint", &&self.hint)
}
}Debug, #[automatically_derived]
impl ::core::marker::Copy for ColorStop { }Copy, #[automatically_derived]
impl ::core::clone::Clone for ColorStop {
#[inline]
fn clone(&self) -> ColorStop {
let _: ::core::clone::AssertParamIsClone<Color>;
let _: ::core::clone::AssertParamIsClone<Val>;
let _: ::core::clone::AssertParamIsClone<f32>;
*self
}
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for ColorStop {
#[inline]
fn eq(&self, other: &ColorStop) -> bool {
self.hint == other.hint && self.color == other.color &&
self.point == other.point
}
}PartialEq, const _: () =
{
impl bevy_reflect::GetTypeRegistration for ColorStop where {
fn get_type_registration() -> bevy_reflect::TypeRegistration {
let mut registration =
bevy_reflect::TypeRegistration::of::<Self>();
registration.insert::<bevy_reflect::ReflectFromPtr>(bevy_reflect::FromType::<Self>::from_type());
registration.insert::<bevy_reflect::ReflectFromReflect>(bevy_reflect::FromType::<Self>::from_type());
registration.register_type_data::<ReflectDefault, Self>();
registration.register_type_data::<ReflectSerialize, Self>();
registration.register_type_data::<ReflectDeserialize, Self>();
registration
}
#[inline(never)]
fn register_type_dependencies(registry:
&mut bevy_reflect::TypeRegistry) {
<Color as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
<Val as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
<f32 as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
}
}
impl bevy_reflect::Typed for ColorStop where {
#[inline]
fn type_info() -> &'static bevy_reflect::TypeInfo {
static CELL: bevy_reflect::utility::NonGenericTypeInfoCell =
bevy_reflect::utility::NonGenericTypeInfoCell::new();
CELL.get_or_set(||
{
bevy_reflect::TypeInfo::Struct(bevy_reflect::structs::StructInfo::new::<Self>(&[bevy_reflect::NamedField::new::<Color>("color"),
bevy_reflect::NamedField::new::<Val>("point"),
bevy_reflect::NamedField::new::<f32>("hint")]))
})
}
}
#[allow(deprecated, reason =
"derives on a deprecated type shouldn't be considered a usage")]
impl bevy_reflect::TypePath for ColorStop where {
fn type_path() -> &'static str { "bevy_ui::gradients::ColorStop" }
fn short_type_path() -> &'static str { "ColorStop" }
fn type_ident() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("ColorStop")
}
fn crate_name() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients".split(':').next().unwrap())
}
fn module_path() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients")
}
}
impl bevy_reflect::Reflect for ColorStop where {
#[inline]
fn into_any(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn ::core::any::Any> {
self
}
#[inline]
fn as_any(&self) -> &dyn ::core::any::Any { self }
#[inline]
fn as_any_mut(&mut self) -> &mut dyn ::core::any::Any { self }
#[inline]
fn into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect> {
self
}
#[inline]
fn as_reflect(&self) -> &dyn bevy_reflect::Reflect { self }
#[inline]
fn as_reflect_mut(&mut self) -> &mut dyn bevy_reflect::Reflect {
self
}
#[inline]
fn set(&mut self,
value:
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>)
->
::core::result::Result<(),
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>> {
*self = <dyn bevy_reflect::Reflect>::take(value)?;
::core::result::Result::Ok(())
}
}
#[allow(non_upper_case_globals)]
const _: () =
{
static __INVENTORY: ::inventory::Node =
::inventory::Node {
value: &{
bevy_reflect::__macro_exports::auto_register::AutomaticReflectRegistrations(<ColorStop
as
bevy_reflect::__macro_exports::auto_register::RegisterForReflection>::__register)
},
next: ::inventory::__private::UnsafeCell::new(::inventory::__private::Option::None),
};
#[link_section = ".text.startup"]
unsafe extern "C" fn __ctor() {
unsafe {
::inventory::ErasedNode::submit(__INVENTORY.value,
&__INVENTORY)
}
}
#[used]
#[link_section = ".init_array"]
static __CTOR: unsafe extern "C" fn() = __ctor;
};
impl bevy_reflect::structs::Struct for ColorStop where {
fn field(&self, name: &str)
-> ::core::option::Option<&dyn bevy_reflect::PartialReflect> {
match name {
"color" => ::core::option::Option::Some(&self.color),
"point" => ::core::option::Option::Some(&self.point),
"hint" => ::core::option::Option::Some(&self.hint),
_ => ::core::option::Option::None,
}
}
fn field_mut(&mut self, name: &str)
->
::core::option::Option<&mut dyn bevy_reflect::PartialReflect> {
match name {
"color" => ::core::option::Option::Some(&mut self.color),
"point" => ::core::option::Option::Some(&mut self.point),
"hint" => ::core::option::Option::Some(&mut self.hint),
_ => ::core::option::Option::None,
}
}
fn field_at(&self, index: usize)
-> ::core::option::Option<&dyn bevy_reflect::PartialReflect> {
match index {
0usize => ::core::option::Option::Some(&self.color),
1usize => ::core::option::Option::Some(&self.point),
2usize => ::core::option::Option::Some(&self.hint),
_ => ::core::option::Option::None,
}
}
fn field_at_mut(&mut self, index: usize)
->
::core::option::Option<&mut dyn bevy_reflect::PartialReflect> {
match index {
0usize => ::core::option::Option::Some(&mut self.color),
1usize => ::core::option::Option::Some(&mut self.point),
2usize => ::core::option::Option::Some(&mut self.hint),
_ => ::core::option::Option::None,
}
}
fn name_at(&self, index: usize) -> ::core::option::Option<&str> {
match index {
0usize => ::core::option::Option::Some("color"),
1usize => ::core::option::Option::Some("point"),
2usize => ::core::option::Option::Some("hint"),
_ => ::core::option::Option::None,
}
}
fn index_of_name(&self, name: &str)
-> ::core::option::Option<usize> {
match name {
"color" => ::core::option::Option::Some(0usize),
"point" => ::core::option::Option::Some(1usize),
"hint" => ::core::option::Option::Some(2usize),
_ => ::core::option::Option::None,
}
}
fn field_len(&self) -> usize { 3usize }
fn iter_fields(&self) -> bevy_reflect::structs::FieldIter {
bevy_reflect::structs::FieldIter::new(self)
}
fn to_dynamic_struct(&self)
-> bevy_reflect::structs::DynamicStruct {
let mut dynamic: bevy_reflect::structs::DynamicStruct =
::core::default::Default::default();
dynamic.set_represented_type(bevy_reflect::PartialReflect::get_represented_type_info(self));
dynamic.insert_boxed("color",
bevy_reflect::PartialReflect::to_dynamic(&self.color));
dynamic.insert_boxed("point",
bevy_reflect::PartialReflect::to_dynamic(&self.point));
dynamic.insert_boxed("hint",
bevy_reflect::PartialReflect::to_dynamic(&self.hint));
dynamic
}
}
impl bevy_reflect::PartialReflect for ColorStop where {
#[inline]
fn get_represented_type_info(&self)
-> ::core::option::Option<&'static bevy_reflect::TypeInfo> {
::core::option::Option::Some(<Self as
bevy_reflect::Typed>::type_info())
}
#[inline]
fn try_apply(&mut self, value: &dyn bevy_reflect::PartialReflect)
-> ::core::result::Result<(), bevy_reflect::ApplyError> {
if let bevy_reflect::ReflectRef::Struct(struct_value) =
bevy_reflect::PartialReflect::reflect_ref(value) {
for (name, value) in
bevy_reflect::structs::Struct::iter_fields(struct_value) {
if let ::core::option::Option::Some(v) =
bevy_reflect::structs::Struct::field_mut(self, name) {
bevy_reflect::PartialReflect::try_apply(v, value)?;
}
}
} else {
return ::core::result::Result::Err(bevy_reflect::ApplyError::MismatchedKinds {
from_kind: bevy_reflect::PartialReflect::reflect_kind(value),
to_kind: bevy_reflect::ReflectKind::Struct,
});
}
::core::result::Result::Ok(())
}
#[inline]
fn reflect_kind(&self) -> bevy_reflect::ReflectKind {
bevy_reflect::ReflectKind::Struct
}
#[inline]
fn reflect_ref(&self) -> bevy_reflect::ReflectRef {
bevy_reflect::ReflectRef::Struct(self)
}
#[inline]
fn reflect_mut(&mut self) -> bevy_reflect::ReflectMut {
bevy_reflect::ReflectMut::Struct(self)
}
#[inline]
fn reflect_owned(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
-> bevy_reflect::ReflectOwned {
bevy_reflect::ReflectOwned::Struct(self)
}
#[inline]
fn try_into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect>> {
::core::result::Result::Ok(self)
}
#[inline]
fn try_as_reflect(&self)
-> ::core::option::Option<&dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn try_as_reflect_mut(&mut self)
-> ::core::option::Option<&mut dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn into_partial_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect> {
self
}
#[inline]
fn as_partial_reflect(&self)
-> &dyn bevy_reflect::PartialReflect {
self
}
#[inline]
fn as_partial_reflect_mut(&mut self)
-> &mut dyn bevy_reflect::PartialReflect {
self
}
fn reflect_partial_eq(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<bool> {
let value =
<dyn bevy_reflect::PartialReflect>::try_downcast_ref::<Self>(value);
if let ::core::option::Option::Some(value) = value {
::core::option::Option::Some(::core::cmp::PartialEq::eq(self,
value))
} else { ::core::option::Option::Some(false) }
}
fn reflect_partial_cmp(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<::core::cmp::Ordering> {
(bevy_reflect::structs::struct_partial_cmp)(self, value)
}
fn debug(&self, f: &mut ::core::fmt::Formatter<'_>)
-> ::core::fmt::Result {
::core::fmt::Debug::fmt(self, f)
}
#[inline]
#[allow(unreachable_code, reason =
"Ignored fields without a `clone` attribute will early-return with an error")]
fn reflect_clone(&self)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::ReflectCloneError> {
::core::result::Result::Ok(bevy_reflect::__macro_exports::alloc_utils::Box::new(Self {
color: <Color as
bevy_reflect::PartialReflect>::reflect_clone_and_take(&self.color)?,
point: <Val as
bevy_reflect::PartialReflect>::reflect_clone_and_take(&self.point)?,
hint: <f32 as
bevy_reflect::PartialReflect>::reflect_clone_and_take(&self.hint)?,
}))
}
}
impl bevy_reflect::FromReflect for ColorStop where {
fn from_reflect(reflect: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<Self> {
if let bevy_reflect::ReflectRef::Struct(__ref_struct) =
bevy_reflect::PartialReflect::reflect_ref(reflect) {
let mut __this =
<Self as ::core::default::Default>::default();
if let ::core::option::Option::Some(__field) =
(||
<Color as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::structs::Struct::field(__ref_struct,
"color")?))() {
__this.color = __field;
}
if let ::core::option::Option::Some(__field) =
(||
<Val as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::structs::Struct::field(__ref_struct,
"point")?))() {
__this.point = __field;
}
if let ::core::option::Option::Some(__field) =
(||
<f32 as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::structs::Struct::field(__ref_struct,
"hint")?))() {
__this.hint = __field;
}
::core::option::Option::Some(__this)
} else { ::core::option::Option::None }
}
}
};Reflect)]
11#[reflect(Default, PartialEq, Debug)]
12#[cfg_attr(
13 feature = "serialize",
14 derive(#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl _serde::Serialize for ColorStop {
fn serialize<__S>(&self, __serializer: __S)
-> _serde::__private228::Result<__S::Ok, __S::Error> where
__S: _serde::Serializer {
let mut __serde_state =
_serde::Serializer::serialize_struct(__serializer,
"ColorStop", false as usize + 1 + 1 + 1)?;
_serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
"color", &self.color)?;
_serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
"point", &self.point)?;
_serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
"hint", &self.hint)?;
_serde::ser::SerializeStruct::end(__serde_state)
}
}
};serde::Serialize, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for ColorStop {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
#[allow(non_camel_case_types)]
#[doc(hidden)]
enum __Field { __field0, __field1, __field2, __ignore, }
#[doc(hidden)]
struct __FieldVisitor;
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
type Value = __Field;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"field identifier")
}
fn visit_u64<__E>(self, __value: u64)
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
0u64 => _serde::__private228::Ok(__Field::__field0),
1u64 => _serde::__private228::Ok(__Field::__field1),
2u64 => _serde::__private228::Ok(__Field::__field2),
_ => _serde::__private228::Ok(__Field::__ignore),
}
}
fn visit_str<__E>(self, __value: &str)
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
"color" => _serde::__private228::Ok(__Field::__field0),
"point" => _serde::__private228::Ok(__Field::__field1),
"hint" => _serde::__private228::Ok(__Field::__field2),
_ => { _serde::__private228::Ok(__Field::__ignore) }
}
}
fn visit_bytes<__E>(self, __value: &[u8])
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
b"color" => _serde::__private228::Ok(__Field::__field0),
b"point" => _serde::__private228::Ok(__Field::__field1),
b"hint" => _serde::__private228::Ok(__Field::__field2),
_ => { _serde::__private228::Ok(__Field::__ignore) }
}
}
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::Deserializer::deserialize_identifier(__deserializer,
__FieldVisitor)
}
}
#[doc(hidden)]
struct __Visitor<'de> {
marker: _serde::__private228::PhantomData<ColorStop>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __Visitor<'de> {
type Value = ColorStop;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"struct ColorStop")
}
#[inline]
fn visit_seq<__A>(self, mut __seq: __A)
-> _serde::__private228::Result<Self::Value, __A::Error>
where __A: _serde::de::SeqAccess<'de> {
let __field0 =
match _serde::de::SeqAccess::next_element::<Color>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(0usize,
&"struct ColorStop with 3 elements")),
};
let __field1 =
match _serde::de::SeqAccess::next_element::<Val>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(1usize,
&"struct ColorStop with 3 elements")),
};
let __field2 =
match _serde::de::SeqAccess::next_element::<f32>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(2usize,
&"struct ColorStop with 3 elements")),
};
_serde::__private228::Ok(ColorStop {
color: __field0,
point: __field1,
hint: __field2,
})
}
#[inline]
fn visit_map<__A>(self, mut __map: __A)
-> _serde::__private228::Result<Self::Value, __A::Error>
where __A: _serde::de::MapAccess<'de> {
let mut __field0: _serde::__private228::Option<Color> =
_serde::__private228::None;
let mut __field1: _serde::__private228::Option<Val> =
_serde::__private228::None;
let mut __field2: _serde::__private228::Option<f32> =
_serde::__private228::None;
while let _serde::__private228::Some(__key) =
_serde::de::MapAccess::next_key::<__Field>(&mut __map)? {
match __key {
__Field::__field0 => {
if _serde::__private228::Option::is_some(&__field0) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("color"));
}
__field0 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<Color>(&mut __map)?);
}
__Field::__field1 => {
if _serde::__private228::Option::is_some(&__field1) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("point"));
}
__field1 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<Val>(&mut __map)?);
}
__Field::__field2 => {
if _serde::__private228::Option::is_some(&__field2) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("hint"));
}
__field2 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<f32>(&mut __map)?);
}
_ => {
let _ =
_serde::de::MapAccess::next_value::<_serde::de::IgnoredAny>(&mut __map)?;
}
}
}
let __field0 =
match __field0 {
_serde::__private228::Some(__field0) => __field0,
_serde::__private228::None =>
_serde::__private228::de::missing_field("color")?,
};
let __field1 =
match __field1 {
_serde::__private228::Some(__field1) => __field1,
_serde::__private228::None =>
_serde::__private228::de::missing_field("point")?,
};
let __field2 =
match __field2 {
_serde::__private228::Some(__field2) => __field2,
_serde::__private228::None =>
_serde::__private228::de::missing_field("hint")?,
};
_serde::__private228::Ok(ColorStop {
color: __field0,
point: __field1,
hint: __field2,
})
}
}
#[doc(hidden)]
const FIELDS: &'static [&'static str] =
&["color", "point", "hint"];
_serde::Deserializer::deserialize_struct(__deserializer,
"ColorStop", FIELDS,
__Visitor {
marker: _serde::__private228::PhantomData::<ColorStop>,
lifetime: _serde::__private228::PhantomData,
})
}
}
};serde::Deserialize),
15 reflect(Serialize, Deserialize)
16)]
17pub struct ColorStop {
18 pub color: Color,
20 pub point: Val,
23 pub hint: f32,
25}
26
27impl ColorStop {
28 pub fn new(color: impl Into<Color>, point: Val) -> Self {
30 Self {
31 color: color.into(),
32 point,
33 hint: 0.5,
34 }
35 }
36
37 pub fn auto(color: impl Into<Color>) -> Self {
40 Self {
41 color: color.into(),
42 point: Val::Auto,
43 hint: 0.5,
44 }
45 }
46
47 pub fn px<V: ValNum>(color: impl Into<Color>, px: V) -> Self {
49 Self {
50 color: color.into(),
51 point: Val::Px(px.val_num_f32()),
52 hint: 0.5,
53 }
54 }
55
56 pub fn percent<V: ValNum>(color: impl Into<Color>, percent: V) -> Self {
58 Self {
59 color: color.into(),
60 point: Val::Percent(percent.val_num_f32()),
61 hint: 0.5,
62 }
63 }
64
65 pub const fn with_hint(mut self, hint: f32) -> Self {
67 self.hint = hint;
68 self
69 }
70}
71
72impl From<(Color, Val)> for ColorStop {
73 fn from((color, stop): (Color, Val)) -> Self {
74 Self {
75 color,
76 point: stop,
77 hint: 0.5,
78 }
79 }
80}
81
82impl From<Color> for ColorStop {
83 fn from(color: Color) -> Self {
84 Self {
85 color,
86 point: Val::Auto,
87 hint: 0.5,
88 }
89 }
90}
91
92impl From<Srgba> for ColorStop {
93 fn from(color: Srgba) -> Self {
94 Self {
95 color: color.into(),
96 point: Val::Auto,
97 hint: 0.5,
98 }
99 }
100}
101
102impl Default for ColorStop {
103 fn default() -> Self {
104 Self {
105 color: Color::WHITE,
106 point: Val::Auto,
107 hint: 0.5,
108 }
109 }
110}
111
112#[derive(#[automatically_derived]
impl ::core::fmt::Debug for AngularColorStop {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"AngularColorStop", "color", &self.color, "angle", &self.angle,
"hint", &&self.hint)
}
}Debug, #[automatically_derived]
impl ::core::marker::Copy for AngularColorStop { }Copy, #[automatically_derived]
impl ::core::clone::Clone for AngularColorStop {
#[inline]
fn clone(&self) -> AngularColorStop {
let _: ::core::clone::AssertParamIsClone<Color>;
let _: ::core::clone::AssertParamIsClone<Option<f32>>;
let _: ::core::clone::AssertParamIsClone<f32>;
*self
}
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for AngularColorStop {
#[inline]
fn eq(&self, other: &AngularColorStop) -> bool {
self.hint == other.hint && self.color == other.color &&
self.angle == other.angle
}
}PartialEq, const _: () =
{
impl bevy_reflect::GetTypeRegistration for AngularColorStop where {
fn get_type_registration() -> bevy_reflect::TypeRegistration {
let mut registration =
bevy_reflect::TypeRegistration::of::<Self>();
registration.insert::<bevy_reflect::ReflectFromPtr>(bevy_reflect::FromType::<Self>::from_type());
registration.insert::<bevy_reflect::ReflectFromReflect>(bevy_reflect::FromType::<Self>::from_type());
registration.register_type_data::<ReflectDefault, Self>();
registration.register_type_data::<ReflectSerialize, Self>();
registration.register_type_data::<ReflectDeserialize, Self>();
registration
}
#[inline(never)]
fn register_type_dependencies(registry:
&mut bevy_reflect::TypeRegistry) {
<Color as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
<Option<f32> as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
<f32 as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
}
}
impl bevy_reflect::Typed for AngularColorStop where {
#[inline]
fn type_info() -> &'static bevy_reflect::TypeInfo {
static CELL: bevy_reflect::utility::NonGenericTypeInfoCell =
bevy_reflect::utility::NonGenericTypeInfoCell::new();
CELL.get_or_set(||
{
bevy_reflect::TypeInfo::Struct(bevy_reflect::structs::StructInfo::new::<Self>(&[bevy_reflect::NamedField::new::<Color>("color"),
bevy_reflect::NamedField::new::<Option<f32>>("angle"),
bevy_reflect::NamedField::new::<f32>("hint")]))
})
}
}
#[allow(deprecated, reason =
"derives on a deprecated type shouldn't be considered a usage")]
impl bevy_reflect::TypePath for AngularColorStop where {
fn type_path() -> &'static str {
"bevy_ui::gradients::AngularColorStop"
}
fn short_type_path() -> &'static str { "AngularColorStop" }
fn type_ident() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("AngularColorStop")
}
fn crate_name() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients".split(':').next().unwrap())
}
fn module_path() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients")
}
}
impl bevy_reflect::Reflect for AngularColorStop where {
#[inline]
fn into_any(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn ::core::any::Any> {
self
}
#[inline]
fn as_any(&self) -> &dyn ::core::any::Any { self }
#[inline]
fn as_any_mut(&mut self) -> &mut dyn ::core::any::Any { self }
#[inline]
fn into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect> {
self
}
#[inline]
fn as_reflect(&self) -> &dyn bevy_reflect::Reflect { self }
#[inline]
fn as_reflect_mut(&mut self) -> &mut dyn bevy_reflect::Reflect {
self
}
#[inline]
fn set(&mut self,
value:
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>)
->
::core::result::Result<(),
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>> {
*self = <dyn bevy_reflect::Reflect>::take(value)?;
::core::result::Result::Ok(())
}
}
#[allow(non_upper_case_globals)]
const _: () =
{
static __INVENTORY: ::inventory::Node =
::inventory::Node {
value: &{
bevy_reflect::__macro_exports::auto_register::AutomaticReflectRegistrations(<AngularColorStop
as
bevy_reflect::__macro_exports::auto_register::RegisterForReflection>::__register)
},
next: ::inventory::__private::UnsafeCell::new(::inventory::__private::Option::None),
};
#[link_section = ".text.startup"]
unsafe extern "C" fn __ctor() {
unsafe {
::inventory::ErasedNode::submit(__INVENTORY.value,
&__INVENTORY)
}
}
#[used]
#[link_section = ".init_array"]
static __CTOR: unsafe extern "C" fn() = __ctor;
};
impl bevy_reflect::structs::Struct for AngularColorStop where {
fn field(&self, name: &str)
-> ::core::option::Option<&dyn bevy_reflect::PartialReflect> {
match name {
"color" => ::core::option::Option::Some(&self.color),
"angle" => ::core::option::Option::Some(&self.angle),
"hint" => ::core::option::Option::Some(&self.hint),
_ => ::core::option::Option::None,
}
}
fn field_mut(&mut self, name: &str)
->
::core::option::Option<&mut dyn bevy_reflect::PartialReflect> {
match name {
"color" => ::core::option::Option::Some(&mut self.color),
"angle" => ::core::option::Option::Some(&mut self.angle),
"hint" => ::core::option::Option::Some(&mut self.hint),
_ => ::core::option::Option::None,
}
}
fn field_at(&self, index: usize)
-> ::core::option::Option<&dyn bevy_reflect::PartialReflect> {
match index {
0usize => ::core::option::Option::Some(&self.color),
1usize => ::core::option::Option::Some(&self.angle),
2usize => ::core::option::Option::Some(&self.hint),
_ => ::core::option::Option::None,
}
}
fn field_at_mut(&mut self, index: usize)
->
::core::option::Option<&mut dyn bevy_reflect::PartialReflect> {
match index {
0usize => ::core::option::Option::Some(&mut self.color),
1usize => ::core::option::Option::Some(&mut self.angle),
2usize => ::core::option::Option::Some(&mut self.hint),
_ => ::core::option::Option::None,
}
}
fn name_at(&self, index: usize) -> ::core::option::Option<&str> {
match index {
0usize => ::core::option::Option::Some("color"),
1usize => ::core::option::Option::Some("angle"),
2usize => ::core::option::Option::Some("hint"),
_ => ::core::option::Option::None,
}
}
fn index_of_name(&self, name: &str)
-> ::core::option::Option<usize> {
match name {
"color" => ::core::option::Option::Some(0usize),
"angle" => ::core::option::Option::Some(1usize),
"hint" => ::core::option::Option::Some(2usize),
_ => ::core::option::Option::None,
}
}
fn field_len(&self) -> usize { 3usize }
fn iter_fields(&self) -> bevy_reflect::structs::FieldIter {
bevy_reflect::structs::FieldIter::new(self)
}
fn to_dynamic_struct(&self)
-> bevy_reflect::structs::DynamicStruct {
let mut dynamic: bevy_reflect::structs::DynamicStruct =
::core::default::Default::default();
dynamic.set_represented_type(bevy_reflect::PartialReflect::get_represented_type_info(self));
dynamic.insert_boxed("color",
bevy_reflect::PartialReflect::to_dynamic(&self.color));
dynamic.insert_boxed("angle",
bevy_reflect::PartialReflect::to_dynamic(&self.angle));
dynamic.insert_boxed("hint",
bevy_reflect::PartialReflect::to_dynamic(&self.hint));
dynamic
}
}
impl bevy_reflect::PartialReflect for AngularColorStop where {
#[inline]
fn get_represented_type_info(&self)
-> ::core::option::Option<&'static bevy_reflect::TypeInfo> {
::core::option::Option::Some(<Self as
bevy_reflect::Typed>::type_info())
}
#[inline]
fn try_apply(&mut self, value: &dyn bevy_reflect::PartialReflect)
-> ::core::result::Result<(), bevy_reflect::ApplyError> {
if let bevy_reflect::ReflectRef::Struct(struct_value) =
bevy_reflect::PartialReflect::reflect_ref(value) {
for (name, value) in
bevy_reflect::structs::Struct::iter_fields(struct_value) {
if let ::core::option::Option::Some(v) =
bevy_reflect::structs::Struct::field_mut(self, name) {
bevy_reflect::PartialReflect::try_apply(v, value)?;
}
}
} else {
return ::core::result::Result::Err(bevy_reflect::ApplyError::MismatchedKinds {
from_kind: bevy_reflect::PartialReflect::reflect_kind(value),
to_kind: bevy_reflect::ReflectKind::Struct,
});
}
::core::result::Result::Ok(())
}
#[inline]
fn reflect_kind(&self) -> bevy_reflect::ReflectKind {
bevy_reflect::ReflectKind::Struct
}
#[inline]
fn reflect_ref(&self) -> bevy_reflect::ReflectRef {
bevy_reflect::ReflectRef::Struct(self)
}
#[inline]
fn reflect_mut(&mut self) -> bevy_reflect::ReflectMut {
bevy_reflect::ReflectMut::Struct(self)
}
#[inline]
fn reflect_owned(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
-> bevy_reflect::ReflectOwned {
bevy_reflect::ReflectOwned::Struct(self)
}
#[inline]
fn try_into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect>> {
::core::result::Result::Ok(self)
}
#[inline]
fn try_as_reflect(&self)
-> ::core::option::Option<&dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn try_as_reflect_mut(&mut self)
-> ::core::option::Option<&mut dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn into_partial_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect> {
self
}
#[inline]
fn as_partial_reflect(&self)
-> &dyn bevy_reflect::PartialReflect {
self
}
#[inline]
fn as_partial_reflect_mut(&mut self)
-> &mut dyn bevy_reflect::PartialReflect {
self
}
fn reflect_partial_eq(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<bool> {
let value =
<dyn bevy_reflect::PartialReflect>::try_downcast_ref::<Self>(value);
if let ::core::option::Option::Some(value) = value {
::core::option::Option::Some(::core::cmp::PartialEq::eq(self,
value))
} else { ::core::option::Option::Some(false) }
}
fn reflect_partial_cmp(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<::core::cmp::Ordering> {
(bevy_reflect::structs::struct_partial_cmp)(self, value)
}
fn debug(&self, f: &mut ::core::fmt::Formatter<'_>)
-> ::core::fmt::Result {
::core::fmt::Debug::fmt(self, f)
}
#[inline]
#[allow(unreachable_code, reason =
"Ignored fields without a `clone` attribute will early-return with an error")]
fn reflect_clone(&self)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::ReflectCloneError> {
::core::result::Result::Ok(bevy_reflect::__macro_exports::alloc_utils::Box::new(Self {
color: <Color as
bevy_reflect::PartialReflect>::reflect_clone_and_take(&self.color)?,
angle: <Option<f32> as
bevy_reflect::PartialReflect>::reflect_clone_and_take(&self.angle)?,
hint: <f32 as
bevy_reflect::PartialReflect>::reflect_clone_and_take(&self.hint)?,
}))
}
}
impl bevy_reflect::FromReflect for AngularColorStop where {
fn from_reflect(reflect: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<Self> {
if let bevy_reflect::ReflectRef::Struct(__ref_struct) =
bevy_reflect::PartialReflect::reflect_ref(reflect) {
let mut __this =
<Self as ::core::default::Default>::default();
if let ::core::option::Option::Some(__field) =
(||
<Color as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::structs::Struct::field(__ref_struct,
"color")?))() {
__this.color = __field;
}
if let ::core::option::Option::Some(__field) =
(||
<Option<f32> as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::structs::Struct::field(__ref_struct,
"angle")?))() {
__this.angle = __field;
}
if let ::core::option::Option::Some(__field) =
(||
<f32 as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::structs::Struct::field(__ref_struct,
"hint")?))() {
__this.hint = __field;
}
::core::option::Option::Some(__this)
} else { ::core::option::Option::None }
}
}
};Reflect)]
114#[reflect(Default, PartialEq, Debug)]
115#[cfg_attr(
116 feature = "serialize",
117 derive(#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl _serde::Serialize for AngularColorStop {
fn serialize<__S>(&self, __serializer: __S)
-> _serde::__private228::Result<__S::Ok, __S::Error> where
__S: _serde::Serializer {
let mut __serde_state =
_serde::Serializer::serialize_struct(__serializer,
"AngularColorStop", false as usize + 1 + 1 + 1)?;
_serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
"color", &self.color)?;
_serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
"angle", &self.angle)?;
_serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
"hint", &self.hint)?;
_serde::ser::SerializeStruct::end(__serde_state)
}
}
};serde::Serialize, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for AngularColorStop {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
#[allow(non_camel_case_types)]
#[doc(hidden)]
enum __Field { __field0, __field1, __field2, __ignore, }
#[doc(hidden)]
struct __FieldVisitor;
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
type Value = __Field;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"field identifier")
}
fn visit_u64<__E>(self, __value: u64)
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
0u64 => _serde::__private228::Ok(__Field::__field0),
1u64 => _serde::__private228::Ok(__Field::__field1),
2u64 => _serde::__private228::Ok(__Field::__field2),
_ => _serde::__private228::Ok(__Field::__ignore),
}
}
fn visit_str<__E>(self, __value: &str)
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
"color" => _serde::__private228::Ok(__Field::__field0),
"angle" => _serde::__private228::Ok(__Field::__field1),
"hint" => _serde::__private228::Ok(__Field::__field2),
_ => { _serde::__private228::Ok(__Field::__ignore) }
}
}
fn visit_bytes<__E>(self, __value: &[u8])
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
b"color" => _serde::__private228::Ok(__Field::__field0),
b"angle" => _serde::__private228::Ok(__Field::__field1),
b"hint" => _serde::__private228::Ok(__Field::__field2),
_ => { _serde::__private228::Ok(__Field::__ignore) }
}
}
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::Deserializer::deserialize_identifier(__deserializer,
__FieldVisitor)
}
}
#[doc(hidden)]
struct __Visitor<'de> {
marker: _serde::__private228::PhantomData<AngularColorStop>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __Visitor<'de> {
type Value = AngularColorStop;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"struct AngularColorStop")
}
#[inline]
fn visit_seq<__A>(self, mut __seq: __A)
-> _serde::__private228::Result<Self::Value, __A::Error>
where __A: _serde::de::SeqAccess<'de> {
let __field0 =
match _serde::de::SeqAccess::next_element::<Color>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(0usize,
&"struct AngularColorStop with 3 elements")),
};
let __field1 =
match _serde::de::SeqAccess::next_element::<Option<f32>>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(1usize,
&"struct AngularColorStop with 3 elements")),
};
let __field2 =
match _serde::de::SeqAccess::next_element::<f32>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(2usize,
&"struct AngularColorStop with 3 elements")),
};
_serde::__private228::Ok(AngularColorStop {
color: __field0,
angle: __field1,
hint: __field2,
})
}
#[inline]
fn visit_map<__A>(self, mut __map: __A)
-> _serde::__private228::Result<Self::Value, __A::Error>
where __A: _serde::de::MapAccess<'de> {
let mut __field0: _serde::__private228::Option<Color> =
_serde::__private228::None;
let mut __field1:
_serde::__private228::Option<Option<f32>> =
_serde::__private228::None;
let mut __field2: _serde::__private228::Option<f32> =
_serde::__private228::None;
while let _serde::__private228::Some(__key) =
_serde::de::MapAccess::next_key::<__Field>(&mut __map)? {
match __key {
__Field::__field0 => {
if _serde::__private228::Option::is_some(&__field0) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("color"));
}
__field0 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<Color>(&mut __map)?);
}
__Field::__field1 => {
if _serde::__private228::Option::is_some(&__field1) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("angle"));
}
__field1 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<Option<f32>>(&mut __map)?);
}
__Field::__field2 => {
if _serde::__private228::Option::is_some(&__field2) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("hint"));
}
__field2 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<f32>(&mut __map)?);
}
_ => {
let _ =
_serde::de::MapAccess::next_value::<_serde::de::IgnoredAny>(&mut __map)?;
}
}
}
let __field0 =
match __field0 {
_serde::__private228::Some(__field0) => __field0,
_serde::__private228::None =>
_serde::__private228::de::missing_field("color")?,
};
let __field1 =
match __field1 {
_serde::__private228::Some(__field1) => __field1,
_serde::__private228::None =>
_serde::__private228::de::missing_field("angle")?,
};
let __field2 =
match __field2 {
_serde::__private228::Some(__field2) => __field2,
_serde::__private228::None =>
_serde::__private228::de::missing_field("hint")?,
};
_serde::__private228::Ok(AngularColorStop {
color: __field0,
angle: __field1,
hint: __field2,
})
}
}
#[doc(hidden)]
const FIELDS: &'static [&'static str] =
&["color", "angle", "hint"];
_serde::Deserializer::deserialize_struct(__deserializer,
"AngularColorStop", FIELDS,
__Visitor {
marker: _serde::__private228::PhantomData::<AngularColorStop>,
lifetime: _serde::__private228::PhantomData,
})
}
}
};serde::Deserialize),
118 reflect(Serialize, Deserialize)
119)]
120pub struct AngularColorStop {
121 pub color: Color,
123 pub angle: Option<f32>,
153 pub hint: f32,
155}
156
157impl AngularColorStop {
158 pub fn new(color: impl Into<Color>, angle: f32) -> Self {
160 Self {
161 color: color.into(),
162 angle: Some(angle),
163 hint: 0.5,
164 }
165 }
166
167 pub fn auto(color: impl Into<Color>) -> Self {
170 Self {
171 color: color.into(),
172 angle: None,
173 hint: 0.5,
174 }
175 }
176
177 pub const fn with_hint(mut self, hint: f32) -> Self {
179 self.hint = hint;
180 self
181 }
182}
183
184impl From<(Color, f32)> for AngularColorStop {
185 fn from((color, angle): (Color, f32)) -> Self {
186 Self {
187 color,
188 angle: Some(angle),
189 hint: 0.5,
190 }
191 }
192}
193
194impl From<Color> for AngularColorStop {
195 fn from(color: Color) -> Self {
196 Self {
197 color,
198 angle: None,
199 hint: 0.5,
200 }
201 }
202}
203
204impl From<Srgba> for AngularColorStop {
205 fn from(color: Srgba) -> Self {
206 Self {
207 color: color.into(),
208 angle: None,
209 hint: 0.5,
210 }
211 }
212}
213
214impl Default for AngularColorStop {
215 fn default() -> Self {
216 Self {
217 color: Color::WHITE,
218 angle: None,
219 hint: 0.5,
220 }
221 }
222}
223
224#[derive(#[automatically_derived]
impl ::core::default::Default for LinearGradient {
#[inline]
fn default() -> LinearGradient {
LinearGradient {
color_space: ::core::default::Default::default(),
angle: ::core::default::Default::default(),
stops: ::core::default::Default::default(),
}
}
}Default, #[automatically_derived]
impl ::core::clone::Clone for LinearGradient {
#[inline]
fn clone(&self) -> LinearGradient {
LinearGradient {
color_space: ::core::clone::Clone::clone(&self.color_space),
angle: ::core::clone::Clone::clone(&self.angle),
stops: ::core::clone::Clone::clone(&self.stops),
}
}
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for LinearGradient {
#[inline]
fn eq(&self, other: &LinearGradient) -> bool {
self.angle == other.angle && self.color_space == other.color_space &&
self.stops == other.stops
}
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for LinearGradient {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field3_finish(f,
"LinearGradient", "color_space", &self.color_space, "angle",
&self.angle, "stops", &&self.stops)
}
}Debug, const _: () =
{
impl bevy_reflect::GetTypeRegistration for LinearGradient where {
fn get_type_registration() -> bevy_reflect::TypeRegistration {
let mut registration =
bevy_reflect::TypeRegistration::of::<Self>();
registration.insert::<bevy_reflect::ReflectFromPtr>(bevy_reflect::FromType::<Self>::from_type());
registration.insert::<bevy_reflect::ReflectFromReflect>(bevy_reflect::FromType::<Self>::from_type());
registration.register_type_data::<ReflectSerialize, Self>();
registration.register_type_data::<ReflectDeserialize, Self>();
registration
}
#[inline(never)]
fn register_type_dependencies(registry:
&mut bevy_reflect::TypeRegistry) {
<InterpolationColorSpace as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
<f32 as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
<Vec<ColorStop> as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
}
}
impl bevy_reflect::Typed for LinearGradient where {
#[inline]
fn type_info() -> &'static bevy_reflect::TypeInfo {
static CELL: bevy_reflect::utility::NonGenericTypeInfoCell =
bevy_reflect::utility::NonGenericTypeInfoCell::new();
CELL.get_or_set(||
{
bevy_reflect::TypeInfo::Struct(bevy_reflect::structs::StructInfo::new::<Self>(&[bevy_reflect::NamedField::new::<InterpolationColorSpace>("color_space"),
bevy_reflect::NamedField::new::<f32>("angle"),
bevy_reflect::NamedField::new::<Vec<ColorStop>>("stops")]))
})
}
}
#[allow(deprecated, reason =
"derives on a deprecated type shouldn't be considered a usage")]
impl bevy_reflect::TypePath for LinearGradient where {
fn type_path() -> &'static str {
"bevy_ui::gradients::LinearGradient"
}
fn short_type_path() -> &'static str { "LinearGradient" }
fn type_ident() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("LinearGradient")
}
fn crate_name() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients".split(':').next().unwrap())
}
fn module_path() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients")
}
}
impl bevy_reflect::Reflect for LinearGradient where {
#[inline]
fn into_any(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn ::core::any::Any> {
self
}
#[inline]
fn as_any(&self) -> &dyn ::core::any::Any { self }
#[inline]
fn as_any_mut(&mut self) -> &mut dyn ::core::any::Any { self }
#[inline]
fn into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect> {
self
}
#[inline]
fn as_reflect(&self) -> &dyn bevy_reflect::Reflect { self }
#[inline]
fn as_reflect_mut(&mut self) -> &mut dyn bevy_reflect::Reflect {
self
}
#[inline]
fn set(&mut self,
value:
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>)
->
::core::result::Result<(),
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>> {
*self = <dyn bevy_reflect::Reflect>::take(value)?;
::core::result::Result::Ok(())
}
}
#[allow(non_upper_case_globals)]
const _: () =
{
static __INVENTORY: ::inventory::Node =
::inventory::Node {
value: &{
bevy_reflect::__macro_exports::auto_register::AutomaticReflectRegistrations(<LinearGradient
as
bevy_reflect::__macro_exports::auto_register::RegisterForReflection>::__register)
},
next: ::inventory::__private::UnsafeCell::new(::inventory::__private::Option::None),
};
#[link_section = ".text.startup"]
unsafe extern "C" fn __ctor() {
unsafe {
::inventory::ErasedNode::submit(__INVENTORY.value,
&__INVENTORY)
}
}
#[used]
#[link_section = ".init_array"]
static __CTOR: unsafe extern "C" fn() = __ctor;
};
impl bevy_reflect::structs::Struct for LinearGradient where {
fn field(&self, name: &str)
-> ::core::option::Option<&dyn bevy_reflect::PartialReflect> {
match name {
"color_space" =>
::core::option::Option::Some(&self.color_space),
"angle" => ::core::option::Option::Some(&self.angle),
"stops" => ::core::option::Option::Some(&self.stops),
_ => ::core::option::Option::None,
}
}
fn field_mut(&mut self, name: &str)
->
::core::option::Option<&mut dyn bevy_reflect::PartialReflect> {
match name {
"color_space" =>
::core::option::Option::Some(&mut self.color_space),
"angle" => ::core::option::Option::Some(&mut self.angle),
"stops" => ::core::option::Option::Some(&mut self.stops),
_ => ::core::option::Option::None,
}
}
fn field_at(&self, index: usize)
-> ::core::option::Option<&dyn bevy_reflect::PartialReflect> {
match index {
0usize => ::core::option::Option::Some(&self.color_space),
1usize => ::core::option::Option::Some(&self.angle),
2usize => ::core::option::Option::Some(&self.stops),
_ => ::core::option::Option::None,
}
}
fn field_at_mut(&mut self, index: usize)
->
::core::option::Option<&mut dyn bevy_reflect::PartialReflect> {
match index {
0usize =>
::core::option::Option::Some(&mut self.color_space),
1usize => ::core::option::Option::Some(&mut self.angle),
2usize => ::core::option::Option::Some(&mut self.stops),
_ => ::core::option::Option::None,
}
}
fn name_at(&self, index: usize) -> ::core::option::Option<&str> {
match index {
0usize => ::core::option::Option::Some("color_space"),
1usize => ::core::option::Option::Some("angle"),
2usize => ::core::option::Option::Some("stops"),
_ => ::core::option::Option::None,
}
}
fn index_of_name(&self, name: &str)
-> ::core::option::Option<usize> {
match name {
"color_space" => ::core::option::Option::Some(0usize),
"angle" => ::core::option::Option::Some(1usize),
"stops" => ::core::option::Option::Some(2usize),
_ => ::core::option::Option::None,
}
}
fn field_len(&self) -> usize { 3usize }
fn iter_fields(&self) -> bevy_reflect::structs::FieldIter {
bevy_reflect::structs::FieldIter::new(self)
}
fn to_dynamic_struct(&self)
-> bevy_reflect::structs::DynamicStruct {
let mut dynamic: bevy_reflect::structs::DynamicStruct =
::core::default::Default::default();
dynamic.set_represented_type(bevy_reflect::PartialReflect::get_represented_type_info(self));
dynamic.insert_boxed("color_space",
bevy_reflect::PartialReflect::to_dynamic(&self.color_space));
dynamic.insert_boxed("angle",
bevy_reflect::PartialReflect::to_dynamic(&self.angle));
dynamic.insert_boxed("stops",
bevy_reflect::PartialReflect::to_dynamic(&self.stops));
dynamic
}
}
impl bevy_reflect::PartialReflect for LinearGradient where {
#[inline]
fn get_represented_type_info(&self)
-> ::core::option::Option<&'static bevy_reflect::TypeInfo> {
::core::option::Option::Some(<Self as
bevy_reflect::Typed>::type_info())
}
#[inline]
fn try_apply(&mut self, value: &dyn bevy_reflect::PartialReflect)
-> ::core::result::Result<(), bevy_reflect::ApplyError> {
if let bevy_reflect::ReflectRef::Struct(struct_value) =
bevy_reflect::PartialReflect::reflect_ref(value) {
for (name, value) in
bevy_reflect::structs::Struct::iter_fields(struct_value) {
if let ::core::option::Option::Some(v) =
bevy_reflect::structs::Struct::field_mut(self, name) {
bevy_reflect::PartialReflect::try_apply(v, value)?;
}
}
} else {
return ::core::result::Result::Err(bevy_reflect::ApplyError::MismatchedKinds {
from_kind: bevy_reflect::PartialReflect::reflect_kind(value),
to_kind: bevy_reflect::ReflectKind::Struct,
});
}
::core::result::Result::Ok(())
}
#[inline]
fn reflect_kind(&self) -> bevy_reflect::ReflectKind {
bevy_reflect::ReflectKind::Struct
}
#[inline]
fn reflect_ref(&self) -> bevy_reflect::ReflectRef {
bevy_reflect::ReflectRef::Struct(self)
}
#[inline]
fn reflect_mut(&mut self) -> bevy_reflect::ReflectMut {
bevy_reflect::ReflectMut::Struct(self)
}
#[inline]
fn reflect_owned(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
-> bevy_reflect::ReflectOwned {
bevy_reflect::ReflectOwned::Struct(self)
}
#[inline]
fn try_into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect>> {
::core::result::Result::Ok(self)
}
#[inline]
fn try_as_reflect(&self)
-> ::core::option::Option<&dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn try_as_reflect_mut(&mut self)
-> ::core::option::Option<&mut dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn into_partial_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect> {
self
}
#[inline]
fn as_partial_reflect(&self)
-> &dyn bevy_reflect::PartialReflect {
self
}
#[inline]
fn as_partial_reflect_mut(&mut self)
-> &mut dyn bevy_reflect::PartialReflect {
self
}
fn reflect_partial_eq(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<bool> {
let value =
<dyn bevy_reflect::PartialReflect>::try_downcast_ref::<Self>(value);
if let ::core::option::Option::Some(value) = value {
::core::option::Option::Some(::core::cmp::PartialEq::eq(self,
value))
} else { ::core::option::Option::Some(false) }
}
fn reflect_partial_cmp(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<::core::cmp::Ordering> {
(bevy_reflect::structs::struct_partial_cmp)(self, value)
}
#[inline]
#[allow(unreachable_code, reason =
"Ignored fields without a `clone` attribute will early-return with an error")]
fn reflect_clone(&self)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::ReflectCloneError> {
::core::result::Result::Ok(bevy_reflect::__macro_exports::alloc_utils::Box::new(Self {
color_space: <InterpolationColorSpace as
bevy_reflect::PartialReflect>::reflect_clone_and_take(&self.color_space)?,
angle: <f32 as
bevy_reflect::PartialReflect>::reflect_clone_and_take(&self.angle)?,
stops: <Vec<ColorStop> as
bevy_reflect::PartialReflect>::reflect_clone_and_take(&self.stops)?,
}))
}
}
impl bevy_reflect::FromReflect for LinearGradient where {
fn from_reflect(reflect: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<Self> {
if let bevy_reflect::ReflectRef::Struct(__ref_struct) =
bevy_reflect::PartialReflect::reflect_ref(reflect) {
let __this =
Self {
color_space: <InterpolationColorSpace as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::structs::Struct::field(__ref_struct,
"color_space")?)?,
angle: <f32 as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::structs::Struct::field(__ref_struct,
"angle")?)?,
stops: <Vec<ColorStop> as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::structs::Struct::field(__ref_struct,
"stops")?)?,
};
::core::option::Option::Some(__this)
} else { ::core::option::Option::None }
}
}
};Reflect)]
228#[reflect(PartialEq)]
229#[cfg_attr(
230 feature = "serialize",
231 derive(#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl _serde::Serialize for LinearGradient {
fn serialize<__S>(&self, __serializer: __S)
-> _serde::__private228::Result<__S::Ok, __S::Error> where
__S: _serde::Serializer {
let mut __serde_state =
_serde::Serializer::serialize_struct(__serializer,
"LinearGradient", false as usize + 1 + 1 + 1)?;
_serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
"color_space", &self.color_space)?;
_serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
"angle", &self.angle)?;
_serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
"stops", &self.stops)?;
_serde::ser::SerializeStruct::end(__serde_state)
}
}
};serde::Serialize, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for LinearGradient {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
#[allow(non_camel_case_types)]
#[doc(hidden)]
enum __Field { __field0, __field1, __field2, __ignore, }
#[doc(hidden)]
struct __FieldVisitor;
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
type Value = __Field;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"field identifier")
}
fn visit_u64<__E>(self, __value: u64)
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
0u64 => _serde::__private228::Ok(__Field::__field0),
1u64 => _serde::__private228::Ok(__Field::__field1),
2u64 => _serde::__private228::Ok(__Field::__field2),
_ => _serde::__private228::Ok(__Field::__ignore),
}
}
fn visit_str<__E>(self, __value: &str)
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
"color_space" =>
_serde::__private228::Ok(__Field::__field0),
"angle" => _serde::__private228::Ok(__Field::__field1),
"stops" => _serde::__private228::Ok(__Field::__field2),
_ => { _serde::__private228::Ok(__Field::__ignore) }
}
}
fn visit_bytes<__E>(self, __value: &[u8])
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
b"color_space" =>
_serde::__private228::Ok(__Field::__field0),
b"angle" => _serde::__private228::Ok(__Field::__field1),
b"stops" => _serde::__private228::Ok(__Field::__field2),
_ => { _serde::__private228::Ok(__Field::__ignore) }
}
}
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::Deserializer::deserialize_identifier(__deserializer,
__FieldVisitor)
}
}
#[doc(hidden)]
struct __Visitor<'de> {
marker: _serde::__private228::PhantomData<LinearGradient>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __Visitor<'de> {
type Value = LinearGradient;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"struct LinearGradient")
}
#[inline]
fn visit_seq<__A>(self, mut __seq: __A)
-> _serde::__private228::Result<Self::Value, __A::Error>
where __A: _serde::de::SeqAccess<'de> {
let __field0 =
match _serde::de::SeqAccess::next_element::<InterpolationColorSpace>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(0usize,
&"struct LinearGradient with 3 elements")),
};
let __field1 =
match _serde::de::SeqAccess::next_element::<f32>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(1usize,
&"struct LinearGradient with 3 elements")),
};
let __field2 =
match _serde::de::SeqAccess::next_element::<Vec<ColorStop>>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(2usize,
&"struct LinearGradient with 3 elements")),
};
_serde::__private228::Ok(LinearGradient {
color_space: __field0,
angle: __field1,
stops: __field2,
})
}
#[inline]
fn visit_map<__A>(self, mut __map: __A)
-> _serde::__private228::Result<Self::Value, __A::Error>
where __A: _serde::de::MapAccess<'de> {
let mut __field0:
_serde::__private228::Option<InterpolationColorSpace> =
_serde::__private228::None;
let mut __field1: _serde::__private228::Option<f32> =
_serde::__private228::None;
let mut __field2:
_serde::__private228::Option<Vec<ColorStop>> =
_serde::__private228::None;
while let _serde::__private228::Some(__key) =
_serde::de::MapAccess::next_key::<__Field>(&mut __map)? {
match __key {
__Field::__field0 => {
if _serde::__private228::Option::is_some(&__field0) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("color_space"));
}
__field0 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<InterpolationColorSpace>(&mut __map)?);
}
__Field::__field1 => {
if _serde::__private228::Option::is_some(&__field1) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("angle"));
}
__field1 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<f32>(&mut __map)?);
}
__Field::__field2 => {
if _serde::__private228::Option::is_some(&__field2) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("stops"));
}
__field2 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<Vec<ColorStop>>(&mut __map)?);
}
_ => {
let _ =
_serde::de::MapAccess::next_value::<_serde::de::IgnoredAny>(&mut __map)?;
}
}
}
let __field0 =
match __field0 {
_serde::__private228::Some(__field0) => __field0,
_serde::__private228::None =>
_serde::__private228::de::missing_field("color_space")?,
};
let __field1 =
match __field1 {
_serde::__private228::Some(__field1) => __field1,
_serde::__private228::None =>
_serde::__private228::de::missing_field("angle")?,
};
let __field2 =
match __field2 {
_serde::__private228::Some(__field2) => __field2,
_serde::__private228::None =>
_serde::__private228::de::missing_field("stops")?,
};
_serde::__private228::Ok(LinearGradient {
color_space: __field0,
angle: __field1,
stops: __field2,
})
}
}
#[doc(hidden)]
const FIELDS: &'static [&'static str] =
&["color_space", "angle", "stops"];
_serde::Deserializer::deserialize_struct(__deserializer,
"LinearGradient", FIELDS,
__Visitor {
marker: _serde::__private228::PhantomData::<LinearGradient>,
lifetime: _serde::__private228::PhantomData,
})
}
}
};serde::Deserialize),
232 reflect(Serialize, Deserialize)
233)]
234pub struct LinearGradient {
235 pub color_space: InterpolationColorSpace,
237 pub angle: f32,
240 pub stops: Vec<ColorStop>,
242}
243
244impl LinearGradient {
245 pub const TO_TOP: f32 = 0.;
247 pub const TO_TOP_RIGHT: f32 = TAU / 8.;
249 pub const TO_RIGHT: f32 = 2. * Self::TO_TOP_RIGHT;
251 pub const TO_BOTTOM_RIGHT: f32 = 3. * Self::TO_TOP_RIGHT;
253 pub const TO_BOTTOM: f32 = 4. * Self::TO_TOP_RIGHT;
255 pub const TO_BOTTOM_LEFT: f32 = 5. * Self::TO_TOP_RIGHT;
257 pub const TO_LEFT: f32 = 6. * Self::TO_TOP_RIGHT;
259 pub const TO_TOP_LEFT: f32 = 7. * Self::TO_TOP_RIGHT;
261
262 pub fn new(angle: f32, stops: Vec<ColorStop>) -> Self {
264 Self {
265 angle,
266 stops,
267 color_space: InterpolationColorSpace::default(),
268 }
269 }
270
271 pub fn to_top(stops: Vec<ColorStop>) -> Self {
273 Self {
274 angle: Self::TO_TOP,
275 stops,
276 color_space: InterpolationColorSpace::default(),
277 }
278 }
279
280 pub fn to_top_right(stops: Vec<ColorStop>) -> Self {
282 Self {
283 angle: Self::TO_TOP_RIGHT,
284 stops,
285 color_space: InterpolationColorSpace::default(),
286 }
287 }
288
289 pub fn to_right(stops: Vec<ColorStop>) -> Self {
291 Self {
292 angle: Self::TO_RIGHT,
293 stops,
294 color_space: InterpolationColorSpace::default(),
295 }
296 }
297
298 pub fn to_bottom_right(stops: Vec<ColorStop>) -> Self {
300 Self {
301 angle: Self::TO_BOTTOM_RIGHT,
302 stops,
303 color_space: InterpolationColorSpace::default(),
304 }
305 }
306
307 pub fn to_bottom(stops: Vec<ColorStop>) -> Self {
309 Self {
310 angle: Self::TO_BOTTOM,
311 stops,
312 color_space: InterpolationColorSpace::default(),
313 }
314 }
315
316 pub fn to_bottom_left(stops: Vec<ColorStop>) -> Self {
318 Self {
319 angle: Self::TO_BOTTOM_LEFT,
320 stops,
321 color_space: InterpolationColorSpace::default(),
322 }
323 }
324
325 pub fn to_left(stops: Vec<ColorStop>) -> Self {
327 Self {
328 angle: Self::TO_LEFT,
329 stops,
330 color_space: InterpolationColorSpace::default(),
331 }
332 }
333
334 pub fn to_top_left(stops: Vec<ColorStop>) -> Self {
336 Self {
337 angle: Self::TO_TOP_LEFT,
338 stops,
339 color_space: InterpolationColorSpace::default(),
340 }
341 }
342
343 pub fn degrees(degrees: f32, stops: Vec<ColorStop>) -> Self {
345 Self {
346 angle: degrees.to_radians(),
347 stops,
348 color_space: InterpolationColorSpace::default(),
349 }
350 }
351
352 pub fn in_color_space(mut self, color_space: InterpolationColorSpace) -> Self {
353 self.color_space = color_space;
354 self
355 }
356}
357
358#[derive(#[automatically_derived]
impl ::core::clone::Clone for RadialGradient {
#[inline]
fn clone(&self) -> RadialGradient {
RadialGradient {
color_space: ::core::clone::Clone::clone(&self.color_space),
position: ::core::clone::Clone::clone(&self.position),
shape: ::core::clone::Clone::clone(&self.shape),
stops: ::core::clone::Clone::clone(&self.stops),
}
}
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for RadialGradient {
#[inline]
fn eq(&self, other: &RadialGradient) -> bool {
self.color_space == other.color_space &&
self.position == other.position && self.shape == other.shape
&& self.stops == other.stops
}
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for RadialGradient {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"RadialGradient", "color_space", &self.color_space, "position",
&self.position, "shape", &self.shape, "stops", &&self.stops)
}
}Debug, const _: () =
{
impl bevy_reflect::GetTypeRegistration for RadialGradient where {
fn get_type_registration() -> bevy_reflect::TypeRegistration {
let mut registration =
bevy_reflect::TypeRegistration::of::<Self>();
registration.insert::<bevy_reflect::ReflectFromPtr>(bevy_reflect::FromType::<Self>::from_type());
registration.insert::<bevy_reflect::ReflectFromReflect>(bevy_reflect::FromType::<Self>::from_type());
registration.register_type_data::<ReflectSerialize, Self>();
registration.register_type_data::<ReflectDeserialize, Self>();
registration
}
#[inline(never)]
fn register_type_dependencies(registry:
&mut bevy_reflect::TypeRegistry) {
<InterpolationColorSpace as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
<UiPosition as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
<RadialGradientShape as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
<Vec<ColorStop> as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
}
}
impl bevy_reflect::Typed for RadialGradient where {
#[inline]
fn type_info() -> &'static bevy_reflect::TypeInfo {
static CELL: bevy_reflect::utility::NonGenericTypeInfoCell =
bevy_reflect::utility::NonGenericTypeInfoCell::new();
CELL.get_or_set(||
{
bevy_reflect::TypeInfo::Struct(bevy_reflect::structs::StructInfo::new::<Self>(&[bevy_reflect::NamedField::new::<InterpolationColorSpace>("color_space"),
bevy_reflect::NamedField::new::<UiPosition>("position"),
bevy_reflect::NamedField::new::<RadialGradientShape>("shape"),
bevy_reflect::NamedField::new::<Vec<ColorStop>>("stops")]))
})
}
}
#[allow(deprecated, reason =
"derives on a deprecated type shouldn't be considered a usage")]
impl bevy_reflect::TypePath for RadialGradient where {
fn type_path() -> &'static str {
"bevy_ui::gradients::RadialGradient"
}
fn short_type_path() -> &'static str { "RadialGradient" }
fn type_ident() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("RadialGradient")
}
fn crate_name() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients".split(':').next().unwrap())
}
fn module_path() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients")
}
}
impl bevy_reflect::Reflect for RadialGradient where {
#[inline]
fn into_any(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn ::core::any::Any> {
self
}
#[inline]
fn as_any(&self) -> &dyn ::core::any::Any { self }
#[inline]
fn as_any_mut(&mut self) -> &mut dyn ::core::any::Any { self }
#[inline]
fn into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect> {
self
}
#[inline]
fn as_reflect(&self) -> &dyn bevy_reflect::Reflect { self }
#[inline]
fn as_reflect_mut(&mut self) -> &mut dyn bevy_reflect::Reflect {
self
}
#[inline]
fn set(&mut self,
value:
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>)
->
::core::result::Result<(),
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>> {
*self = <dyn bevy_reflect::Reflect>::take(value)?;
::core::result::Result::Ok(())
}
}
#[allow(non_upper_case_globals)]
const _: () =
{
static __INVENTORY: ::inventory::Node =
::inventory::Node {
value: &{
bevy_reflect::__macro_exports::auto_register::AutomaticReflectRegistrations(<RadialGradient
as
bevy_reflect::__macro_exports::auto_register::RegisterForReflection>::__register)
},
next: ::inventory::__private::UnsafeCell::new(::inventory::__private::Option::None),
};
#[link_section = ".text.startup"]
unsafe extern "C" fn __ctor() {
unsafe {
::inventory::ErasedNode::submit(__INVENTORY.value,
&__INVENTORY)
}
}
#[used]
#[link_section = ".init_array"]
static __CTOR: unsafe extern "C" fn() = __ctor;
};
impl bevy_reflect::structs::Struct for RadialGradient where {
fn field(&self, name: &str)
-> ::core::option::Option<&dyn bevy_reflect::PartialReflect> {
match name {
"color_space" =>
::core::option::Option::Some(&self.color_space),
"position" => ::core::option::Option::Some(&self.position),
"shape" => ::core::option::Option::Some(&self.shape),
"stops" => ::core::option::Option::Some(&self.stops),
_ => ::core::option::Option::None,
}
}
fn field_mut(&mut self, name: &str)
->
::core::option::Option<&mut dyn bevy_reflect::PartialReflect> {
match name {
"color_space" =>
::core::option::Option::Some(&mut self.color_space),
"position" =>
::core::option::Option::Some(&mut self.position),
"shape" => ::core::option::Option::Some(&mut self.shape),
"stops" => ::core::option::Option::Some(&mut self.stops),
_ => ::core::option::Option::None,
}
}
fn field_at(&self, index: usize)
-> ::core::option::Option<&dyn bevy_reflect::PartialReflect> {
match index {
0usize => ::core::option::Option::Some(&self.color_space),
1usize => ::core::option::Option::Some(&self.position),
2usize => ::core::option::Option::Some(&self.shape),
3usize => ::core::option::Option::Some(&self.stops),
_ => ::core::option::Option::None,
}
}
fn field_at_mut(&mut self, index: usize)
->
::core::option::Option<&mut dyn bevy_reflect::PartialReflect> {
match index {
0usize =>
::core::option::Option::Some(&mut self.color_space),
1usize => ::core::option::Option::Some(&mut self.position),
2usize => ::core::option::Option::Some(&mut self.shape),
3usize => ::core::option::Option::Some(&mut self.stops),
_ => ::core::option::Option::None,
}
}
fn name_at(&self, index: usize) -> ::core::option::Option<&str> {
match index {
0usize => ::core::option::Option::Some("color_space"),
1usize => ::core::option::Option::Some("position"),
2usize => ::core::option::Option::Some("shape"),
3usize => ::core::option::Option::Some("stops"),
_ => ::core::option::Option::None,
}
}
fn index_of_name(&self, name: &str)
-> ::core::option::Option<usize> {
match name {
"color_space" => ::core::option::Option::Some(0usize),
"position" => ::core::option::Option::Some(1usize),
"shape" => ::core::option::Option::Some(2usize),
"stops" => ::core::option::Option::Some(3usize),
_ => ::core::option::Option::None,
}
}
fn field_len(&self) -> usize { 4usize }
fn iter_fields(&self) -> bevy_reflect::structs::FieldIter {
bevy_reflect::structs::FieldIter::new(self)
}
fn to_dynamic_struct(&self)
-> bevy_reflect::structs::DynamicStruct {
let mut dynamic: bevy_reflect::structs::DynamicStruct =
::core::default::Default::default();
dynamic.set_represented_type(bevy_reflect::PartialReflect::get_represented_type_info(self));
dynamic.insert_boxed("color_space",
bevy_reflect::PartialReflect::to_dynamic(&self.color_space));
dynamic.insert_boxed("position",
bevy_reflect::PartialReflect::to_dynamic(&self.position));
dynamic.insert_boxed("shape",
bevy_reflect::PartialReflect::to_dynamic(&self.shape));
dynamic.insert_boxed("stops",
bevy_reflect::PartialReflect::to_dynamic(&self.stops));
dynamic
}
}
impl bevy_reflect::PartialReflect for RadialGradient where {
#[inline]
fn get_represented_type_info(&self)
-> ::core::option::Option<&'static bevy_reflect::TypeInfo> {
::core::option::Option::Some(<Self as
bevy_reflect::Typed>::type_info())
}
#[inline]
fn try_apply(&mut self, value: &dyn bevy_reflect::PartialReflect)
-> ::core::result::Result<(), bevy_reflect::ApplyError> {
if let bevy_reflect::ReflectRef::Struct(struct_value) =
bevy_reflect::PartialReflect::reflect_ref(value) {
for (name, value) in
bevy_reflect::structs::Struct::iter_fields(struct_value) {
if let ::core::option::Option::Some(v) =
bevy_reflect::structs::Struct::field_mut(self, name) {
bevy_reflect::PartialReflect::try_apply(v, value)?;
}
}
} else {
return ::core::result::Result::Err(bevy_reflect::ApplyError::MismatchedKinds {
from_kind: bevy_reflect::PartialReflect::reflect_kind(value),
to_kind: bevy_reflect::ReflectKind::Struct,
});
}
::core::result::Result::Ok(())
}
#[inline]
fn reflect_kind(&self) -> bevy_reflect::ReflectKind {
bevy_reflect::ReflectKind::Struct
}
#[inline]
fn reflect_ref(&self) -> bevy_reflect::ReflectRef {
bevy_reflect::ReflectRef::Struct(self)
}
#[inline]
fn reflect_mut(&mut self) -> bevy_reflect::ReflectMut {
bevy_reflect::ReflectMut::Struct(self)
}
#[inline]
fn reflect_owned(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
-> bevy_reflect::ReflectOwned {
bevy_reflect::ReflectOwned::Struct(self)
}
#[inline]
fn try_into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect>> {
::core::result::Result::Ok(self)
}
#[inline]
fn try_as_reflect(&self)
-> ::core::option::Option<&dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn try_as_reflect_mut(&mut self)
-> ::core::option::Option<&mut dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn into_partial_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect> {
self
}
#[inline]
fn as_partial_reflect(&self)
-> &dyn bevy_reflect::PartialReflect {
self
}
#[inline]
fn as_partial_reflect_mut(&mut self)
-> &mut dyn bevy_reflect::PartialReflect {
self
}
fn reflect_partial_eq(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<bool> {
let value =
<dyn bevy_reflect::PartialReflect>::try_downcast_ref::<Self>(value);
if let ::core::option::Option::Some(value) = value {
::core::option::Option::Some(::core::cmp::PartialEq::eq(self,
value))
} else { ::core::option::Option::Some(false) }
}
fn reflect_partial_cmp(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<::core::cmp::Ordering> {
(bevy_reflect::structs::struct_partial_cmp)(self, value)
}
#[inline]
#[allow(unreachable_code, reason =
"Ignored fields without a `clone` attribute will early-return with an error")]
fn reflect_clone(&self)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::ReflectCloneError> {
::core::result::Result::Ok(bevy_reflect::__macro_exports::alloc_utils::Box::new(Self {
color_space: <InterpolationColorSpace as
bevy_reflect::PartialReflect>::reflect_clone_and_take(&self.color_space)?,
position: <UiPosition as
bevy_reflect::PartialReflect>::reflect_clone_and_take(&self.position)?,
shape: <RadialGradientShape as
bevy_reflect::PartialReflect>::reflect_clone_and_take(&self.shape)?,
stops: <Vec<ColorStop> as
bevy_reflect::PartialReflect>::reflect_clone_and_take(&self.stops)?,
}))
}
}
impl bevy_reflect::FromReflect for RadialGradient where {
fn from_reflect(reflect: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<Self> {
if let bevy_reflect::ReflectRef::Struct(__ref_struct) =
bevy_reflect::PartialReflect::reflect_ref(reflect) {
let __this =
Self {
color_space: <InterpolationColorSpace as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::structs::Struct::field(__ref_struct,
"color_space")?)?,
position: <UiPosition as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::structs::Struct::field(__ref_struct,
"position")?)?,
shape: <RadialGradientShape as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::structs::Struct::field(__ref_struct,
"shape")?)?,
stops: <Vec<ColorStop> as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::structs::Struct::field(__ref_struct,
"stops")?)?,
};
::core::option::Option::Some(__this)
} else { ::core::option::Option::None }
}
}
};Reflect)]
362#[reflect(PartialEq)]
363#[cfg_attr(
364 feature = "serialize",
365 derive(#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl _serde::Serialize for RadialGradient {
fn serialize<__S>(&self, __serializer: __S)
-> _serde::__private228::Result<__S::Ok, __S::Error> where
__S: _serde::Serializer {
let mut __serde_state =
_serde::Serializer::serialize_struct(__serializer,
"RadialGradient", false as usize + 1 + 1 + 1 + 1)?;
_serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
"color_space", &self.color_space)?;
_serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
"position", &self.position)?;
_serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
"shape", &self.shape)?;
_serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
"stops", &self.stops)?;
_serde::ser::SerializeStruct::end(__serde_state)
}
}
};serde::Serialize, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for RadialGradient {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
#[allow(non_camel_case_types)]
#[doc(hidden)]
enum __Field {
__field0,
__field1,
__field2,
__field3,
__ignore,
}
#[doc(hidden)]
struct __FieldVisitor;
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
type Value = __Field;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"field identifier")
}
fn visit_u64<__E>(self, __value: u64)
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
0u64 => _serde::__private228::Ok(__Field::__field0),
1u64 => _serde::__private228::Ok(__Field::__field1),
2u64 => _serde::__private228::Ok(__Field::__field2),
3u64 => _serde::__private228::Ok(__Field::__field3),
_ => _serde::__private228::Ok(__Field::__ignore),
}
}
fn visit_str<__E>(self, __value: &str)
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
"color_space" =>
_serde::__private228::Ok(__Field::__field0),
"position" => _serde::__private228::Ok(__Field::__field1),
"shape" => _serde::__private228::Ok(__Field::__field2),
"stops" => _serde::__private228::Ok(__Field::__field3),
_ => { _serde::__private228::Ok(__Field::__ignore) }
}
}
fn visit_bytes<__E>(self, __value: &[u8])
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
b"color_space" =>
_serde::__private228::Ok(__Field::__field0),
b"position" => _serde::__private228::Ok(__Field::__field1),
b"shape" => _serde::__private228::Ok(__Field::__field2),
b"stops" => _serde::__private228::Ok(__Field::__field3),
_ => { _serde::__private228::Ok(__Field::__ignore) }
}
}
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::Deserializer::deserialize_identifier(__deserializer,
__FieldVisitor)
}
}
#[doc(hidden)]
struct __Visitor<'de> {
marker: _serde::__private228::PhantomData<RadialGradient>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __Visitor<'de> {
type Value = RadialGradient;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"struct RadialGradient")
}
#[inline]
fn visit_seq<__A>(self, mut __seq: __A)
-> _serde::__private228::Result<Self::Value, __A::Error>
where __A: _serde::de::SeqAccess<'de> {
let __field0 =
match _serde::de::SeqAccess::next_element::<InterpolationColorSpace>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(0usize,
&"struct RadialGradient with 4 elements")),
};
let __field1 =
match _serde::de::SeqAccess::next_element::<UiPosition>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(1usize,
&"struct RadialGradient with 4 elements")),
};
let __field2 =
match _serde::de::SeqAccess::next_element::<RadialGradientShape>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(2usize,
&"struct RadialGradient with 4 elements")),
};
let __field3 =
match _serde::de::SeqAccess::next_element::<Vec<ColorStop>>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(3usize,
&"struct RadialGradient with 4 elements")),
};
_serde::__private228::Ok(RadialGradient {
color_space: __field0,
position: __field1,
shape: __field2,
stops: __field3,
})
}
#[inline]
fn visit_map<__A>(self, mut __map: __A)
-> _serde::__private228::Result<Self::Value, __A::Error>
where __A: _serde::de::MapAccess<'de> {
let mut __field0:
_serde::__private228::Option<InterpolationColorSpace> =
_serde::__private228::None;
let mut __field1: _serde::__private228::Option<UiPosition> =
_serde::__private228::None;
let mut __field2:
_serde::__private228::Option<RadialGradientShape> =
_serde::__private228::None;
let mut __field3:
_serde::__private228::Option<Vec<ColorStop>> =
_serde::__private228::None;
while let _serde::__private228::Some(__key) =
_serde::de::MapAccess::next_key::<__Field>(&mut __map)? {
match __key {
__Field::__field0 => {
if _serde::__private228::Option::is_some(&__field0) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("color_space"));
}
__field0 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<InterpolationColorSpace>(&mut __map)?);
}
__Field::__field1 => {
if _serde::__private228::Option::is_some(&__field1) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("position"));
}
__field1 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<UiPosition>(&mut __map)?);
}
__Field::__field2 => {
if _serde::__private228::Option::is_some(&__field2) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("shape"));
}
__field2 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<RadialGradientShape>(&mut __map)?);
}
__Field::__field3 => {
if _serde::__private228::Option::is_some(&__field3) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("stops"));
}
__field3 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<Vec<ColorStop>>(&mut __map)?);
}
_ => {
let _ =
_serde::de::MapAccess::next_value::<_serde::de::IgnoredAny>(&mut __map)?;
}
}
}
let __field0 =
match __field0 {
_serde::__private228::Some(__field0) => __field0,
_serde::__private228::None =>
_serde::__private228::de::missing_field("color_space")?,
};
let __field1 =
match __field1 {
_serde::__private228::Some(__field1) => __field1,
_serde::__private228::None =>
_serde::__private228::de::missing_field("position")?,
};
let __field2 =
match __field2 {
_serde::__private228::Some(__field2) => __field2,
_serde::__private228::None =>
_serde::__private228::de::missing_field("shape")?,
};
let __field3 =
match __field3 {
_serde::__private228::Some(__field3) => __field3,
_serde::__private228::None =>
_serde::__private228::de::missing_field("stops")?,
};
_serde::__private228::Ok(RadialGradient {
color_space: __field0,
position: __field1,
shape: __field2,
stops: __field3,
})
}
}
#[doc(hidden)]
const FIELDS: &'static [&'static str] =
&["color_space", "position", "shape", "stops"];
_serde::Deserializer::deserialize_struct(__deserializer,
"RadialGradient", FIELDS,
__Visitor {
marker: _serde::__private228::PhantomData::<RadialGradient>,
lifetime: _serde::__private228::PhantomData,
})
}
}
};serde::Deserialize),
366 reflect(Serialize, Deserialize)
367)]
368pub struct RadialGradient {
369 pub color_space: InterpolationColorSpace,
371 pub position: UiPosition,
373 pub shape: RadialGradientShape,
375 pub stops: Vec<ColorStop>,
377}
378
379impl RadialGradient {
380 pub fn new(position: UiPosition, shape: RadialGradientShape, stops: Vec<ColorStop>) -> Self {
382 Self {
383 color_space: default(),
384 position,
385 shape,
386 stops,
387 }
388 }
389
390 pub const fn in_color_space(mut self, color_space: InterpolationColorSpace) -> Self {
391 self.color_space = color_space;
392 self
393 }
394}
395
396impl Default for RadialGradient {
397 fn default() -> Self {
398 Self {
399 position: UiPosition::CENTER,
400 shape: RadialGradientShape::ClosestCorner,
401 stops: Vec::new(),
402 color_space: default(),
403 }
404 }
405}
406
407#[derive(#[automatically_derived]
impl ::core::default::Default for ConicGradient {
#[inline]
fn default() -> ConicGradient {
ConicGradient {
color_space: ::core::default::Default::default(),
start: ::core::default::Default::default(),
position: ::core::default::Default::default(),
stops: ::core::default::Default::default(),
}
}
}Default, #[automatically_derived]
impl ::core::clone::Clone for ConicGradient {
#[inline]
fn clone(&self) -> ConicGradient {
ConicGradient {
color_space: ::core::clone::Clone::clone(&self.color_space),
start: ::core::clone::Clone::clone(&self.start),
position: ::core::clone::Clone::clone(&self.position),
stops: ::core::clone::Clone::clone(&self.stops),
}
}
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for ConicGradient {
#[inline]
fn eq(&self, other: &ConicGradient) -> bool {
self.start == other.start && self.color_space == other.color_space &&
self.position == other.position && self.stops == other.stops
}
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for ConicGradient {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f, "ConicGradient",
"color_space", &self.color_space, "start", &self.start,
"position", &self.position, "stops", &&self.stops)
}
}Debug, const _: () =
{
impl bevy_reflect::GetTypeRegistration for ConicGradient where {
fn get_type_registration() -> bevy_reflect::TypeRegistration {
let mut registration =
bevy_reflect::TypeRegistration::of::<Self>();
registration.insert::<bevy_reflect::ReflectFromPtr>(bevy_reflect::FromType::<Self>::from_type());
registration.insert::<bevy_reflect::ReflectFromReflect>(bevy_reflect::FromType::<Self>::from_type());
registration.register_type_data::<ReflectSerialize, Self>();
registration.register_type_data::<ReflectDeserialize, Self>();
registration
}
#[inline(never)]
fn register_type_dependencies(registry:
&mut bevy_reflect::TypeRegistry) {
<InterpolationColorSpace as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
<f32 as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
<UiPosition as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
<Vec<AngularColorStop> as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
}
}
impl bevy_reflect::Typed for ConicGradient where {
#[inline]
fn type_info() -> &'static bevy_reflect::TypeInfo {
static CELL: bevy_reflect::utility::NonGenericTypeInfoCell =
bevy_reflect::utility::NonGenericTypeInfoCell::new();
CELL.get_or_set(||
{
bevy_reflect::TypeInfo::Struct(bevy_reflect::structs::StructInfo::new::<Self>(&[bevy_reflect::NamedField::new::<InterpolationColorSpace>("color_space"),
bevy_reflect::NamedField::new::<f32>("start"),
bevy_reflect::NamedField::new::<UiPosition>("position"),
bevy_reflect::NamedField::new::<Vec<AngularColorStop>>("stops")]))
})
}
}
#[allow(deprecated, reason =
"derives on a deprecated type shouldn't be considered a usage")]
impl bevy_reflect::TypePath for ConicGradient where {
fn type_path() -> &'static str {
"bevy_ui::gradients::ConicGradient"
}
fn short_type_path() -> &'static str { "ConicGradient" }
fn type_ident() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("ConicGradient")
}
fn crate_name() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients".split(':').next().unwrap())
}
fn module_path() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients")
}
}
impl bevy_reflect::Reflect for ConicGradient where {
#[inline]
fn into_any(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn ::core::any::Any> {
self
}
#[inline]
fn as_any(&self) -> &dyn ::core::any::Any { self }
#[inline]
fn as_any_mut(&mut self) -> &mut dyn ::core::any::Any { self }
#[inline]
fn into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect> {
self
}
#[inline]
fn as_reflect(&self) -> &dyn bevy_reflect::Reflect { self }
#[inline]
fn as_reflect_mut(&mut self) -> &mut dyn bevy_reflect::Reflect {
self
}
#[inline]
fn set(&mut self,
value:
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>)
->
::core::result::Result<(),
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>> {
*self = <dyn bevy_reflect::Reflect>::take(value)?;
::core::result::Result::Ok(())
}
}
#[allow(non_upper_case_globals)]
const _: () =
{
static __INVENTORY: ::inventory::Node =
::inventory::Node {
value: &{
bevy_reflect::__macro_exports::auto_register::AutomaticReflectRegistrations(<ConicGradient
as
bevy_reflect::__macro_exports::auto_register::RegisterForReflection>::__register)
},
next: ::inventory::__private::UnsafeCell::new(::inventory::__private::Option::None),
};
#[link_section = ".text.startup"]
unsafe extern "C" fn __ctor() {
unsafe {
::inventory::ErasedNode::submit(__INVENTORY.value,
&__INVENTORY)
}
}
#[used]
#[link_section = ".init_array"]
static __CTOR: unsafe extern "C" fn() = __ctor;
};
impl bevy_reflect::structs::Struct for ConicGradient where {
fn field(&self, name: &str)
-> ::core::option::Option<&dyn bevy_reflect::PartialReflect> {
match name {
"color_space" =>
::core::option::Option::Some(&self.color_space),
"start" => ::core::option::Option::Some(&self.start),
"position" => ::core::option::Option::Some(&self.position),
"stops" => ::core::option::Option::Some(&self.stops),
_ => ::core::option::Option::None,
}
}
fn field_mut(&mut self, name: &str)
->
::core::option::Option<&mut dyn bevy_reflect::PartialReflect> {
match name {
"color_space" =>
::core::option::Option::Some(&mut self.color_space),
"start" => ::core::option::Option::Some(&mut self.start),
"position" =>
::core::option::Option::Some(&mut self.position),
"stops" => ::core::option::Option::Some(&mut self.stops),
_ => ::core::option::Option::None,
}
}
fn field_at(&self, index: usize)
-> ::core::option::Option<&dyn bevy_reflect::PartialReflect> {
match index {
0usize => ::core::option::Option::Some(&self.color_space),
1usize => ::core::option::Option::Some(&self.start),
2usize => ::core::option::Option::Some(&self.position),
3usize => ::core::option::Option::Some(&self.stops),
_ => ::core::option::Option::None,
}
}
fn field_at_mut(&mut self, index: usize)
->
::core::option::Option<&mut dyn bevy_reflect::PartialReflect> {
match index {
0usize =>
::core::option::Option::Some(&mut self.color_space),
1usize => ::core::option::Option::Some(&mut self.start),
2usize => ::core::option::Option::Some(&mut self.position),
3usize => ::core::option::Option::Some(&mut self.stops),
_ => ::core::option::Option::None,
}
}
fn name_at(&self, index: usize) -> ::core::option::Option<&str> {
match index {
0usize => ::core::option::Option::Some("color_space"),
1usize => ::core::option::Option::Some("start"),
2usize => ::core::option::Option::Some("position"),
3usize => ::core::option::Option::Some("stops"),
_ => ::core::option::Option::None,
}
}
fn index_of_name(&self, name: &str)
-> ::core::option::Option<usize> {
match name {
"color_space" => ::core::option::Option::Some(0usize),
"start" => ::core::option::Option::Some(1usize),
"position" => ::core::option::Option::Some(2usize),
"stops" => ::core::option::Option::Some(3usize),
_ => ::core::option::Option::None,
}
}
fn field_len(&self) -> usize { 4usize }
fn iter_fields(&self) -> bevy_reflect::structs::FieldIter {
bevy_reflect::structs::FieldIter::new(self)
}
fn to_dynamic_struct(&self)
-> bevy_reflect::structs::DynamicStruct {
let mut dynamic: bevy_reflect::structs::DynamicStruct =
::core::default::Default::default();
dynamic.set_represented_type(bevy_reflect::PartialReflect::get_represented_type_info(self));
dynamic.insert_boxed("color_space",
bevy_reflect::PartialReflect::to_dynamic(&self.color_space));
dynamic.insert_boxed("start",
bevy_reflect::PartialReflect::to_dynamic(&self.start));
dynamic.insert_boxed("position",
bevy_reflect::PartialReflect::to_dynamic(&self.position));
dynamic.insert_boxed("stops",
bevy_reflect::PartialReflect::to_dynamic(&self.stops));
dynamic
}
}
impl bevy_reflect::PartialReflect for ConicGradient where {
#[inline]
fn get_represented_type_info(&self)
-> ::core::option::Option<&'static bevy_reflect::TypeInfo> {
::core::option::Option::Some(<Self as
bevy_reflect::Typed>::type_info())
}
#[inline]
fn try_apply(&mut self, value: &dyn bevy_reflect::PartialReflect)
-> ::core::result::Result<(), bevy_reflect::ApplyError> {
if let bevy_reflect::ReflectRef::Struct(struct_value) =
bevy_reflect::PartialReflect::reflect_ref(value) {
for (name, value) in
bevy_reflect::structs::Struct::iter_fields(struct_value) {
if let ::core::option::Option::Some(v) =
bevy_reflect::structs::Struct::field_mut(self, name) {
bevy_reflect::PartialReflect::try_apply(v, value)?;
}
}
} else {
return ::core::result::Result::Err(bevy_reflect::ApplyError::MismatchedKinds {
from_kind: bevy_reflect::PartialReflect::reflect_kind(value),
to_kind: bevy_reflect::ReflectKind::Struct,
});
}
::core::result::Result::Ok(())
}
#[inline]
fn reflect_kind(&self) -> bevy_reflect::ReflectKind {
bevy_reflect::ReflectKind::Struct
}
#[inline]
fn reflect_ref(&self) -> bevy_reflect::ReflectRef {
bevy_reflect::ReflectRef::Struct(self)
}
#[inline]
fn reflect_mut(&mut self) -> bevy_reflect::ReflectMut {
bevy_reflect::ReflectMut::Struct(self)
}
#[inline]
fn reflect_owned(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
-> bevy_reflect::ReflectOwned {
bevy_reflect::ReflectOwned::Struct(self)
}
#[inline]
fn try_into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect>> {
::core::result::Result::Ok(self)
}
#[inline]
fn try_as_reflect(&self)
-> ::core::option::Option<&dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn try_as_reflect_mut(&mut self)
-> ::core::option::Option<&mut dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn into_partial_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect> {
self
}
#[inline]
fn as_partial_reflect(&self)
-> &dyn bevy_reflect::PartialReflect {
self
}
#[inline]
fn as_partial_reflect_mut(&mut self)
-> &mut dyn bevy_reflect::PartialReflect {
self
}
fn reflect_partial_eq(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<bool> {
let value =
<dyn bevy_reflect::PartialReflect>::try_downcast_ref::<Self>(value);
if let ::core::option::Option::Some(value) = value {
::core::option::Option::Some(::core::cmp::PartialEq::eq(self,
value))
} else { ::core::option::Option::Some(false) }
}
fn reflect_partial_cmp(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<::core::cmp::Ordering> {
(bevy_reflect::structs::struct_partial_cmp)(self, value)
}
#[inline]
#[allow(unreachable_code, reason =
"Ignored fields without a `clone` attribute will early-return with an error")]
fn reflect_clone(&self)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::ReflectCloneError> {
::core::result::Result::Ok(bevy_reflect::__macro_exports::alloc_utils::Box::new(Self {
color_space: <InterpolationColorSpace as
bevy_reflect::PartialReflect>::reflect_clone_and_take(&self.color_space)?,
start: <f32 as
bevy_reflect::PartialReflect>::reflect_clone_and_take(&self.start)?,
position: <UiPosition as
bevy_reflect::PartialReflect>::reflect_clone_and_take(&self.position)?,
stops: <Vec<AngularColorStop> as
bevy_reflect::PartialReflect>::reflect_clone_and_take(&self.stops)?,
}))
}
}
impl bevy_reflect::FromReflect for ConicGradient where {
fn from_reflect(reflect: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<Self> {
if let bevy_reflect::ReflectRef::Struct(__ref_struct) =
bevy_reflect::PartialReflect::reflect_ref(reflect) {
let __this =
Self {
color_space: <InterpolationColorSpace as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::structs::Struct::field(__ref_struct,
"color_space")?)?,
start: <f32 as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::structs::Struct::field(__ref_struct,
"start")?)?,
position: <UiPosition as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::structs::Struct::field(__ref_struct,
"position")?)?,
stops: <Vec<AngularColorStop> as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::structs::Struct::field(__ref_struct,
"stops")?)?,
};
::core::option::Option::Some(__this)
} else { ::core::option::Option::None }
}
}
};Reflect)]
411#[reflect(PartialEq)]
412#[cfg_attr(
413 feature = "serialize",
414 derive(#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl _serde::Serialize for ConicGradient {
fn serialize<__S>(&self, __serializer: __S)
-> _serde::__private228::Result<__S::Ok, __S::Error> where
__S: _serde::Serializer {
let mut __serde_state =
_serde::Serializer::serialize_struct(__serializer,
"ConicGradient", false as usize + 1 + 1 + 1 + 1)?;
_serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
"color_space", &self.color_space)?;
_serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
"start", &self.start)?;
_serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
"position", &self.position)?;
_serde::ser::SerializeStruct::serialize_field(&mut __serde_state,
"stops", &self.stops)?;
_serde::ser::SerializeStruct::end(__serde_state)
}
}
};serde::Serialize, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for ConicGradient {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
#[allow(non_camel_case_types)]
#[doc(hidden)]
enum __Field {
__field0,
__field1,
__field2,
__field3,
__ignore,
}
#[doc(hidden)]
struct __FieldVisitor;
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
type Value = __Field;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"field identifier")
}
fn visit_u64<__E>(self, __value: u64)
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
0u64 => _serde::__private228::Ok(__Field::__field0),
1u64 => _serde::__private228::Ok(__Field::__field1),
2u64 => _serde::__private228::Ok(__Field::__field2),
3u64 => _serde::__private228::Ok(__Field::__field3),
_ => _serde::__private228::Ok(__Field::__ignore),
}
}
fn visit_str<__E>(self, __value: &str)
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
"color_space" =>
_serde::__private228::Ok(__Field::__field0),
"start" => _serde::__private228::Ok(__Field::__field1),
"position" => _serde::__private228::Ok(__Field::__field2),
"stops" => _serde::__private228::Ok(__Field::__field3),
_ => { _serde::__private228::Ok(__Field::__ignore) }
}
}
fn visit_bytes<__E>(self, __value: &[u8])
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
b"color_space" =>
_serde::__private228::Ok(__Field::__field0),
b"start" => _serde::__private228::Ok(__Field::__field1),
b"position" => _serde::__private228::Ok(__Field::__field2),
b"stops" => _serde::__private228::Ok(__Field::__field3),
_ => { _serde::__private228::Ok(__Field::__ignore) }
}
}
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::Deserializer::deserialize_identifier(__deserializer,
__FieldVisitor)
}
}
#[doc(hidden)]
struct __Visitor<'de> {
marker: _serde::__private228::PhantomData<ConicGradient>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __Visitor<'de> {
type Value = ConicGradient;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"struct ConicGradient")
}
#[inline]
fn visit_seq<__A>(self, mut __seq: __A)
-> _serde::__private228::Result<Self::Value, __A::Error>
where __A: _serde::de::SeqAccess<'de> {
let __field0 =
match _serde::de::SeqAccess::next_element::<InterpolationColorSpace>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(0usize,
&"struct ConicGradient with 4 elements")),
};
let __field1 =
match _serde::de::SeqAccess::next_element::<f32>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(1usize,
&"struct ConicGradient with 4 elements")),
};
let __field2 =
match _serde::de::SeqAccess::next_element::<UiPosition>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(2usize,
&"struct ConicGradient with 4 elements")),
};
let __field3 =
match _serde::de::SeqAccess::next_element::<Vec<AngularColorStop>>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(3usize,
&"struct ConicGradient with 4 elements")),
};
_serde::__private228::Ok(ConicGradient {
color_space: __field0,
start: __field1,
position: __field2,
stops: __field3,
})
}
#[inline]
fn visit_map<__A>(self, mut __map: __A)
-> _serde::__private228::Result<Self::Value, __A::Error>
where __A: _serde::de::MapAccess<'de> {
let mut __field0:
_serde::__private228::Option<InterpolationColorSpace> =
_serde::__private228::None;
let mut __field1: _serde::__private228::Option<f32> =
_serde::__private228::None;
let mut __field2: _serde::__private228::Option<UiPosition> =
_serde::__private228::None;
let mut __field3:
_serde::__private228::Option<Vec<AngularColorStop>> =
_serde::__private228::None;
while let _serde::__private228::Some(__key) =
_serde::de::MapAccess::next_key::<__Field>(&mut __map)? {
match __key {
__Field::__field0 => {
if _serde::__private228::Option::is_some(&__field0) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("color_space"));
}
__field0 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<InterpolationColorSpace>(&mut __map)?);
}
__Field::__field1 => {
if _serde::__private228::Option::is_some(&__field1) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("start"));
}
__field1 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<f32>(&mut __map)?);
}
__Field::__field2 => {
if _serde::__private228::Option::is_some(&__field2) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("position"));
}
__field2 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<UiPosition>(&mut __map)?);
}
__Field::__field3 => {
if _serde::__private228::Option::is_some(&__field3) {
return _serde::__private228::Err(<__A::Error as
_serde::de::Error>::duplicate_field("stops"));
}
__field3 =
_serde::__private228::Some(_serde::de::MapAccess::next_value::<Vec<AngularColorStop>>(&mut __map)?);
}
_ => {
let _ =
_serde::de::MapAccess::next_value::<_serde::de::IgnoredAny>(&mut __map)?;
}
}
}
let __field0 =
match __field0 {
_serde::__private228::Some(__field0) => __field0,
_serde::__private228::None =>
_serde::__private228::de::missing_field("color_space")?,
};
let __field1 =
match __field1 {
_serde::__private228::Some(__field1) => __field1,
_serde::__private228::None =>
_serde::__private228::de::missing_field("start")?,
};
let __field2 =
match __field2 {
_serde::__private228::Some(__field2) => __field2,
_serde::__private228::None =>
_serde::__private228::de::missing_field("position")?,
};
let __field3 =
match __field3 {
_serde::__private228::Some(__field3) => __field3,
_serde::__private228::None =>
_serde::__private228::de::missing_field("stops")?,
};
_serde::__private228::Ok(ConicGradient {
color_space: __field0,
start: __field1,
position: __field2,
stops: __field3,
})
}
}
#[doc(hidden)]
const FIELDS: &'static [&'static str] =
&["color_space", "start", "position", "stops"];
_serde::Deserializer::deserialize_struct(__deserializer,
"ConicGradient", FIELDS,
__Visitor {
marker: _serde::__private228::PhantomData::<ConicGradient>,
lifetime: _serde::__private228::PhantomData,
})
}
}
};serde::Deserialize),
415 reflect(Serialize, Deserialize)
416)]
417pub struct ConicGradient {
418 pub color_space: InterpolationColorSpace,
420 pub start: f32,
422 pub position: UiPosition,
424 pub stops: Vec<AngularColorStop>,
426}
427
428impl ConicGradient {
429 pub fn new(position: UiPosition, stops: Vec<AngularColorStop>) -> Self {
431 Self {
432 color_space: default(),
433 start: 0.,
434 position,
435 stops,
436 }
437 }
438
439 pub const fn with_start(mut self, start: f32) -> Self {
441 self.start = start;
442 self
443 }
444
445 pub const fn with_position(mut self, position: UiPosition) -> Self {
447 self.position = position;
448 self
449 }
450
451 pub const fn in_color_space(mut self, color_space: InterpolationColorSpace) -> Self {
452 self.color_space = color_space;
453 self
454 }
455}
456
457#[derive(#[automatically_derived]
impl ::core::clone::Clone for Gradient {
#[inline]
fn clone(&self) -> Gradient {
match self {
Gradient::Linear(__self_0) =>
Gradient::Linear(::core::clone::Clone::clone(__self_0)),
Gradient::Radial(__self_0) =>
Gradient::Radial(::core::clone::Clone::clone(__self_0)),
Gradient::Conic(__self_0) =>
Gradient::Conic(::core::clone::Clone::clone(__self_0)),
}
}
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for Gradient {
#[inline]
fn eq(&self, other: &Gradient) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(Gradient::Linear(__self_0), Gradient::Linear(__arg1_0)) =>
__self_0 == __arg1_0,
(Gradient::Radial(__self_0), Gradient::Radial(__arg1_0)) =>
__self_0 == __arg1_0,
(Gradient::Conic(__self_0), Gradient::Conic(__arg1_0)) =>
__self_0 == __arg1_0,
_ => unsafe { ::core::intrinsics::unreachable() }
}
}
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for Gradient {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Gradient::Linear(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Linear",
&__self_0),
Gradient::Radial(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Radial",
&__self_0),
Gradient::Conic(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Conic",
&__self_0),
}
}
}Debug, const _: () =
{
impl bevy_reflect::GetTypeRegistration for Gradient where {
fn get_type_registration() -> bevy_reflect::TypeRegistration {
let mut registration =
bevy_reflect::TypeRegistration::of::<Self>();
registration.insert::<bevy_reflect::ReflectFromPtr>(bevy_reflect::FromType::<Self>::from_type());
registration.insert::<bevy_reflect::ReflectFromReflect>(bevy_reflect::FromType::<Self>::from_type());
registration.register_type_data::<ReflectSerialize, Self>();
registration.register_type_data::<ReflectDeserialize, Self>();
registration
}
#[inline(never)]
fn register_type_dependencies(registry:
&mut bevy_reflect::TypeRegistry) {
<LinearGradient as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
<RadialGradient as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
<ConicGradient as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
}
}
impl bevy_reflect::Typed for Gradient where {
#[inline]
fn type_info() -> &'static bevy_reflect::TypeInfo {
static CELL: bevy_reflect::utility::NonGenericTypeInfoCell =
bevy_reflect::utility::NonGenericTypeInfoCell::new();
CELL.get_or_set(||
{
bevy_reflect::TypeInfo::Enum(bevy_reflect::enums::EnumInfo::new::<Self>(&[bevy_reflect::enums::VariantInfo::Tuple(bevy_reflect::enums::TupleVariantInfo::new("Linear",
&[bevy_reflect::UnnamedField::new::<LinearGradient>(0usize)])),
bevy_reflect::enums::VariantInfo::Tuple(bevy_reflect::enums::TupleVariantInfo::new("Radial",
&[bevy_reflect::UnnamedField::new::<RadialGradient>(0usize)])),
bevy_reflect::enums::VariantInfo::Tuple(bevy_reflect::enums::TupleVariantInfo::new("Conic",
&[bevy_reflect::UnnamedField::new::<ConicGradient>(0usize)]))]))
})
}
}
#[allow(deprecated, reason =
"derives on a deprecated type shouldn't be considered a usage")]
impl bevy_reflect::TypePath for Gradient where {
fn type_path() -> &'static str { "bevy_ui::gradients::Gradient" }
fn short_type_path() -> &'static str { "Gradient" }
fn type_ident() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("Gradient")
}
fn crate_name() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients".split(':').next().unwrap())
}
fn module_path() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients")
}
}
impl bevy_reflect::Reflect for Gradient where {
#[inline]
fn into_any(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn ::core::any::Any> {
self
}
#[inline]
fn as_any(&self) -> &dyn ::core::any::Any { self }
#[inline]
fn as_any_mut(&mut self) -> &mut dyn ::core::any::Any { self }
#[inline]
fn into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect> {
self
}
#[inline]
fn as_reflect(&self) -> &dyn bevy_reflect::Reflect { self }
#[inline]
fn as_reflect_mut(&mut self) -> &mut dyn bevy_reflect::Reflect {
self
}
#[inline]
fn set(&mut self,
value:
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>)
->
::core::result::Result<(),
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>> {
*self = <dyn bevy_reflect::Reflect>::take(value)?;
::core::result::Result::Ok(())
}
}
#[allow(non_upper_case_globals)]
const _: () =
{
static __INVENTORY: ::inventory::Node =
::inventory::Node {
value: &{
bevy_reflect::__macro_exports::auto_register::AutomaticReflectRegistrations(<Gradient
as
bevy_reflect::__macro_exports::auto_register::RegisterForReflection>::__register)
},
next: ::inventory::__private::UnsafeCell::new(::inventory::__private::Option::None),
};
#[link_section = ".text.startup"]
unsafe extern "C" fn __ctor() {
unsafe {
::inventory::ErasedNode::submit(__INVENTORY.value,
&__INVENTORY)
}
}
#[used]
#[link_section = ".init_array"]
static __CTOR: unsafe extern "C" fn() = __ctor;
};
impl bevy_reflect::enums::Enum for Gradient where {
fn field(&self, __name_param: &str)
-> ::core::option::Option<&dyn bevy_reflect::PartialReflect> {
match self { _ => ::core::option::Option::None, }
}
fn field_at(&self, __index_param: usize)
-> ::core::option::Option<&dyn bevy_reflect::PartialReflect> {
match self {
Gradient::Linear { 0: __value, .. } if
__index_param == 0usize =>
::core::option::Option::Some(__value),
Gradient::Radial { 0: __value, .. } if
__index_param == 0usize =>
::core::option::Option::Some(__value),
Gradient::Conic { 0: __value, .. } if
__index_param == 0usize =>
::core::option::Option::Some(__value),
_ => ::core::option::Option::None,
}
}
fn field_mut(&mut self, __name_param: &str)
->
::core::option::Option<&mut dyn bevy_reflect::PartialReflect> {
match self { _ => ::core::option::Option::None, }
}
fn field_at_mut(&mut self, __index_param: usize)
->
::core::option::Option<&mut dyn bevy_reflect::PartialReflect> {
match self {
Gradient::Linear { 0: __value, .. } if
__index_param == 0usize =>
::core::option::Option::Some(__value),
Gradient::Radial { 0: __value, .. } if
__index_param == 0usize =>
::core::option::Option::Some(__value),
Gradient::Conic { 0: __value, .. } if
__index_param == 0usize =>
::core::option::Option::Some(__value),
_ => ::core::option::Option::None,
}
}
fn index_of(&self, __name_param: &str)
-> ::core::option::Option<usize> {
match self { _ => ::core::option::Option::None, }
}
fn name_at(&self, __index_param: usize)
-> ::core::option::Option<&str> {
match self { _ => ::core::option::Option::None, }
}
fn iter_fields(&self) -> bevy_reflect::enums::VariantFieldIter {
bevy_reflect::enums::VariantFieldIter::new(self)
}
#[inline]
fn field_len(&self) -> usize {
match self {
Gradient::Linear { .. } => 1usize,
Gradient::Radial { .. } => 1usize,
Gradient::Conic { .. } => 1usize,
_ => 0,
}
}
#[inline]
fn variant_name(&self) -> &str {
match self {
Gradient::Linear { .. } => "Linear",
Gradient::Radial { .. } => "Radial",
Gradient::Conic { .. } => "Conic",
_ =>
::core::panicking::panic("internal error: entered unreachable code"),
}
}
#[inline]
fn variant_index(&self) -> usize {
match self {
Gradient::Linear { .. } => 0usize,
Gradient::Radial { .. } => 1usize,
Gradient::Conic { .. } => 2usize,
_ =>
::core::panicking::panic("internal error: entered unreachable code"),
}
}
#[inline]
fn variant_type(&self) -> bevy_reflect::enums::VariantType {
match self {
Gradient::Linear { .. } =>
bevy_reflect::enums::VariantType::Tuple,
Gradient::Radial { .. } =>
bevy_reflect::enums::VariantType::Tuple,
Gradient::Conic { .. } =>
bevy_reflect::enums::VariantType::Tuple,
_ =>
::core::panicking::panic("internal error: entered unreachable code"),
}
}
fn to_dynamic_enum(&self) -> bevy_reflect::enums::DynamicEnum {
bevy_reflect::enums::DynamicEnum::from_ref::<Self>(self)
}
}
impl bevy_reflect::PartialReflect for Gradient where {
#[inline]
fn get_represented_type_info(&self)
-> ::core::option::Option<&'static bevy_reflect::TypeInfo> {
::core::option::Option::Some(<Self as
bevy_reflect::Typed>::type_info())
}
#[inline]
fn try_apply(&mut self,
__value_param: &dyn bevy_reflect::PartialReflect)
-> ::core::result::Result<(), bevy_reflect::ApplyError> {
if let bevy_reflect::ReflectRef::Enum(__value_param) =
bevy_reflect::PartialReflect::reflect_ref(__value_param) {
if bevy_reflect::enums::Enum::variant_name(self) ==
bevy_reflect::enums::Enum::variant_name(__value_param) {
match bevy_reflect::enums::Enum::variant_type(__value_param)
{
bevy_reflect::enums::VariantType::Struct => {
for field in
bevy_reflect::enums::Enum::iter_fields(__value_param) {
let name = field.name().unwrap();
if let ::core::option::Option::Some(v) =
bevy_reflect::enums::Enum::field_mut(self, name) {
bevy_reflect::PartialReflect::try_apply(v, field.value())?;
}
}
}
bevy_reflect::enums::VariantType::Tuple => {
for (index, field) in
::core::iter::Iterator::enumerate(bevy_reflect::enums::Enum::iter_fields(__value_param))
{
if let ::core::option::Option::Some(v) =
bevy_reflect::enums::Enum::field_at_mut(self, index) {
bevy_reflect::PartialReflect::try_apply(v, field.value())?;
}
}
}
_ => {}
}
} else {
match bevy_reflect::enums::Enum::variant_name(__value_param)
{
"Linear" => {
*self =
Gradient::Linear {
0: {
let __0 = __value_param.field_at(0usize);
let __0 =
__0.ok_or(bevy_reflect::ApplyError::MissingEnumField {
variant_name: ::core::convert::Into::into("Linear"),
field_name: ::core::convert::Into::into(".0"),
})?;
<LinearGradient as
bevy_reflect::FromReflect>::from_reflect(__0).ok_or(bevy_reflect::ApplyError::MismatchedTypes {
from_type: ::core::convert::Into::into(bevy_reflect::DynamicTypePath::reflect_type_path(__0)),
to_type: ::core::convert::Into::into(<LinearGradient as
bevy_reflect::TypePath>::type_path()),
})?
},
}
}
"Radial" => {
*self =
Gradient::Radial {
0: {
let __0 = __value_param.field_at(0usize);
let __0 =
__0.ok_or(bevy_reflect::ApplyError::MissingEnumField {
variant_name: ::core::convert::Into::into("Radial"),
field_name: ::core::convert::Into::into(".0"),
})?;
<RadialGradient as
bevy_reflect::FromReflect>::from_reflect(__0).ok_or(bevy_reflect::ApplyError::MismatchedTypes {
from_type: ::core::convert::Into::into(bevy_reflect::DynamicTypePath::reflect_type_path(__0)),
to_type: ::core::convert::Into::into(<RadialGradient as
bevy_reflect::TypePath>::type_path()),
})?
},
}
}
"Conic" => {
*self =
Gradient::Conic {
0: {
let __0 = __value_param.field_at(0usize);
let __0 =
__0.ok_or(bevy_reflect::ApplyError::MissingEnumField {
variant_name: ::core::convert::Into::into("Conic"),
field_name: ::core::convert::Into::into(".0"),
})?;
<ConicGradient as
bevy_reflect::FromReflect>::from_reflect(__0).ok_or(bevy_reflect::ApplyError::MismatchedTypes {
from_type: ::core::convert::Into::into(bevy_reflect::DynamicTypePath::reflect_type_path(__0)),
to_type: ::core::convert::Into::into(<ConicGradient as
bevy_reflect::TypePath>::type_path()),
})?
},
}
}
name => {
return ::core::result::Result::Err(bevy_reflect::ApplyError::UnknownVariant {
enum_name: ::core::convert::Into::into(bevy_reflect::DynamicTypePath::reflect_type_path(self)),
variant_name: ::core::convert::Into::into(name),
});
}
}
}
} else {
return ::core::result::Result::Err(bevy_reflect::ApplyError::MismatchedKinds {
from_kind: bevy_reflect::PartialReflect::reflect_kind(__value_param),
to_kind: bevy_reflect::ReflectKind::Enum,
});
}
::core::result::Result::Ok(())
}
fn reflect_kind(&self) -> bevy_reflect::ReflectKind {
bevy_reflect::ReflectKind::Enum
}
fn reflect_ref(&self) -> bevy_reflect::ReflectRef {
bevy_reflect::ReflectRef::Enum(self)
}
fn reflect_mut(&mut self) -> bevy_reflect::ReflectMut {
bevy_reflect::ReflectMut::Enum(self)
}
fn reflect_owned(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
-> bevy_reflect::ReflectOwned {
bevy_reflect::ReflectOwned::Enum(self)
}
#[inline]
fn try_into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect>> {
::core::result::Result::Ok(self)
}
#[inline]
fn try_as_reflect(&self)
-> ::core::option::Option<&dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn try_as_reflect_mut(&mut self)
-> ::core::option::Option<&mut dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn into_partial_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect> {
self
}
#[inline]
fn as_partial_reflect(&self)
-> &dyn bevy_reflect::PartialReflect {
self
}
#[inline]
fn as_partial_reflect_mut(&mut self)
-> &mut dyn bevy_reflect::PartialReflect {
self
}
fn reflect_hash(&self) -> ::core::option::Option<u64> {
(bevy_reflect::enums::enum_hash)(self)
}
fn reflect_partial_eq(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<bool> {
let value =
<dyn bevy_reflect::PartialReflect>::try_downcast_ref::<Self>(value);
if let ::core::option::Option::Some(value) = value {
::core::option::Option::Some(::core::cmp::PartialEq::eq(self,
value))
} else { ::core::option::Option::Some(false) }
}
fn reflect_partial_cmp(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<::core::cmp::Ordering> {
(bevy_reflect::enums::enum_partial_cmp)(self, value)
}
#[inline]
#[allow(unreachable_code, reason =
"Ignored fields without a `clone` attribute will early-return with an error")]
fn reflect_clone(&self)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::ReflectCloneError> {
let this = self;
::core::result::Result::Ok(bevy_reflect::__macro_exports::alloc_utils::Box::new(match this
{
Gradient::Linear { 0: __0 } =>
Gradient::Linear {
0: <LinearGradient as
bevy_reflect::PartialReflect>::reflect_clone_and_take(__0)?,
},
Gradient::Radial { 0: __0 } =>
Gradient::Radial {
0: <RadialGradient as
bevy_reflect::PartialReflect>::reflect_clone_and_take(__0)?,
},
Gradient::Conic { 0: __0 } =>
Gradient::Conic {
0: <ConicGradient as
bevy_reflect::PartialReflect>::reflect_clone_and_take(__0)?,
},
}))
}
}
impl bevy_reflect::FromReflect for Gradient where {
fn from_reflect(__param0: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<Self> {
if let bevy_reflect::ReflectRef::Enum(__param0) =
bevy_reflect::PartialReflect::reflect_ref(__param0) {
match bevy_reflect::enums::Enum::variant_name(__param0) {
"Linear" =>
::core::option::Option::Some(Gradient::Linear {
0: {
let __0 = __param0.field_at(0usize);
let __0 = __0?;
<LinearGradient as
bevy_reflect::FromReflect>::from_reflect(__0)?
},
}),
"Radial" =>
::core::option::Option::Some(Gradient::Radial {
0: {
let __0 = __param0.field_at(0usize);
let __0 = __0?;
<RadialGradient as
bevy_reflect::FromReflect>::from_reflect(__0)?
},
}),
"Conic" =>
::core::option::Option::Some(Gradient::Conic {
0: {
let __0 = __param0.field_at(0usize);
let __0 = __0?;
<ConicGradient as
bevy_reflect::FromReflect>::from_reflect(__0)?
},
}),
name => ::core::option::Option::None,
}
} else { ::core::option::Option::None }
}
}
};Reflect)]
458#[reflect(PartialEq)]
459#[cfg_attr(
460 feature = "serialize",
461 derive(#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl _serde::Serialize for Gradient {
fn serialize<__S>(&self, __serializer: __S)
-> _serde::__private228::Result<__S::Ok, __S::Error> where
__S: _serde::Serializer {
match *self {
Gradient::Linear(ref __field0) =>
_serde::Serializer::serialize_newtype_variant(__serializer,
"Gradient", 0u32, "Linear", __field0),
Gradient::Radial(ref __field0) =>
_serde::Serializer::serialize_newtype_variant(__serializer,
"Gradient", 1u32, "Radial", __field0),
Gradient::Conic(ref __field0) =>
_serde::Serializer::serialize_newtype_variant(__serializer,
"Gradient", 2u32, "Conic", __field0),
}
}
}
};serde::Serialize, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for Gradient {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
#[allow(non_camel_case_types)]
#[doc(hidden)]
enum __Field { __field0, __field1, __field2, }
#[doc(hidden)]
struct __FieldVisitor;
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
type Value = __Field;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"variant identifier")
}
fn visit_u64<__E>(self, __value: u64)
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
0u64 => _serde::__private228::Ok(__Field::__field0),
1u64 => _serde::__private228::Ok(__Field::__field1),
2u64 => _serde::__private228::Ok(__Field::__field2),
_ =>
_serde::__private228::Err(_serde::de::Error::invalid_value(_serde::de::Unexpected::Unsigned(__value),
&"variant index 0 <= i < 3")),
}
}
fn visit_str<__E>(self, __value: &str)
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
"Linear" => _serde::__private228::Ok(__Field::__field0),
"Radial" => _serde::__private228::Ok(__Field::__field1),
"Conic" => _serde::__private228::Ok(__Field::__field2),
_ => {
_serde::__private228::Err(_serde::de::Error::unknown_variant(__value,
VARIANTS))
}
}
}
fn visit_bytes<__E>(self, __value: &[u8])
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
b"Linear" => _serde::__private228::Ok(__Field::__field0),
b"Radial" => _serde::__private228::Ok(__Field::__field1),
b"Conic" => _serde::__private228::Ok(__Field::__field2),
_ => {
let __value =
&_serde::__private228::from_utf8_lossy(__value);
_serde::__private228::Err(_serde::de::Error::unknown_variant(__value,
VARIANTS))
}
}
}
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::Deserializer::deserialize_identifier(__deserializer,
__FieldVisitor)
}
}
#[doc(hidden)]
struct __Visitor<'de> {
marker: _serde::__private228::PhantomData<Gradient>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __Visitor<'de> {
type Value = Gradient;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"enum Gradient")
}
fn visit_enum<__A>(self, __data: __A)
-> _serde::__private228::Result<Self::Value, __A::Error>
where __A: _serde::de::EnumAccess<'de> {
match _serde::de::EnumAccess::variant(__data)? {
(__Field::__field0, __variant) =>
_serde::__private228::Result::map(_serde::de::VariantAccess::newtype_variant::<LinearGradient>(__variant),
Gradient::Linear),
(__Field::__field1, __variant) =>
_serde::__private228::Result::map(_serde::de::VariantAccess::newtype_variant::<RadialGradient>(__variant),
Gradient::Radial),
(__Field::__field2, __variant) =>
_serde::__private228::Result::map(_serde::de::VariantAccess::newtype_variant::<ConicGradient>(__variant),
Gradient::Conic),
}
}
}
#[doc(hidden)]
const VARIANTS: &'static [&'static str] =
&["Linear", "Radial", "Conic"];
_serde::Deserializer::deserialize_enum(__deserializer,
"Gradient", VARIANTS,
__Visitor {
marker: _serde::__private228::PhantomData::<Gradient>,
lifetime: _serde::__private228::PhantomData,
})
}
}
};serde::Deserialize),
462 reflect(Serialize, Deserialize)
463)]
464pub enum Gradient {
465 Linear(LinearGradient),
469 Radial(RadialGradient),
473 Conic(ConicGradient),
477}
478
479impl Gradient {
480 pub const fn is_empty(&self) -> bool {
482 match self {
483 Gradient::Linear(gradient) => gradient.stops.is_empty(),
484 Gradient::Radial(gradient) => gradient.stops.is_empty(),
485 Gradient::Conic(gradient) => gradient.stops.is_empty(),
486 }
487 }
488
489 pub fn get_single(&self) -> Option<Color> {
491 match self {
492 Gradient::Linear(gradient) => gradient
493 .stops
494 .first()
495 .and_then(|stop| (gradient.stops.len() == 1).then_some(stop.color)),
496 Gradient::Radial(gradient) => gradient
497 .stops
498 .first()
499 .and_then(|stop| (gradient.stops.len() == 1).then_some(stop.color)),
500 Gradient::Conic(gradient) => gradient
501 .stops
502 .first()
503 .and_then(|stop| (gradient.stops.len() == 1).then_some(stop.color)),
504 }
505 }
506}
507
508impl From<LinearGradient> for Gradient {
509 fn from(value: LinearGradient) -> Self {
510 Self::Linear(value)
511 }
512}
513
514impl From<RadialGradient> for Gradient {
515 fn from(value: RadialGradient) -> Self {
516 Self::Radial(value)
517 }
518}
519
520impl From<ConicGradient> for Gradient {
521 fn from(value: ConicGradient) -> Self {
522 Self::Conic(value)
523 }
524}
525
526#[derive(impl bevy_ecs::component::Component for BackgroundGradient where
Self: ::core::marker::Send + ::core::marker::Sync + 'static {
const STORAGE_TYPE: bevy_ecs::component::StorageType =
bevy_ecs::component::StorageType::Table;
type Mutability = bevy_ecs::component::Mutable;
fn register_required_components(_requiree:
bevy_ecs::component::ComponentId,
required_components:
&mut bevy_ecs::component::RequiredComponentsRegistrator) {}
fn clone_behavior() -> bevy_ecs::component::ComponentCloneBehavior {
use bevy_ecs::component::{
DefaultCloneBehaviorBase, DefaultCloneBehaviorViaClone,
};
(&&&bevy_ecs::component::DefaultCloneBehaviorSpecialization::<Self>::default()).default_clone_behavior()
}
fn relationship_accessor()
->
::core::option::Option<bevy_ecs::relationship::ComponentRelationshipAccessor<Self>> {
::core::option::Option::None
}
}Component, #[automatically_derived]
impl ::core::clone::Clone for BackgroundGradient {
#[inline]
fn clone(&self) -> BackgroundGradient {
BackgroundGradient(::core::clone::Clone::clone(&self.0))
}
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for BackgroundGradient {
#[inline]
fn eq(&self, other: &BackgroundGradient) -> bool { self.0 == other.0 }
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for BackgroundGradient {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"BackgroundGradient", &&self.0)
}
}Debug, #[automatically_derived]
impl ::core::default::Default for BackgroundGradient {
#[inline]
fn default() -> BackgroundGradient {
BackgroundGradient(::core::default::Default::default())
}
}Default, const _: () =
{
impl bevy_reflect::GetTypeRegistration for BackgroundGradient where {
fn get_type_registration() -> bevy_reflect::TypeRegistration {
let mut registration =
bevy_reflect::TypeRegistration::of::<Self>();
registration.insert::<bevy_reflect::ReflectFromPtr>(bevy_reflect::FromType::<Self>::from_type());
registration.insert::<bevy_reflect::ReflectFromReflect>(bevy_reflect::FromType::<Self>::from_type());
registration.register_type_data::<ReflectComponent, Self>();
registration.register_type_data::<ReflectDefault, Self>();
registration.register_type_data::<ReflectSerialize, Self>();
registration.register_type_data::<ReflectDeserialize, Self>();
registration
}
#[inline(never)]
fn register_type_dependencies(registry:
&mut bevy_reflect::TypeRegistry) {
<Vec<Gradient> as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
}
}
impl bevy_reflect::Typed for BackgroundGradient where {
#[inline]
fn type_info() -> &'static bevy_reflect::TypeInfo {
static CELL: bevy_reflect::utility::NonGenericTypeInfoCell =
bevy_reflect::utility::NonGenericTypeInfoCell::new();
CELL.get_or_set(||
{
bevy_reflect::TypeInfo::TupleStruct(bevy_reflect::tuple_struct::TupleStructInfo::new::<Self>(&[bevy_reflect::UnnamedField::new::<Vec<Gradient>>(0usize)]))
})
}
}
#[allow(deprecated, reason =
"derives on a deprecated type shouldn't be considered a usage")]
impl bevy_reflect::TypePath for BackgroundGradient where {
fn type_path() -> &'static str {
"bevy_ui::gradients::BackgroundGradient"
}
fn short_type_path() -> &'static str { "BackgroundGradient" }
fn type_ident() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("BackgroundGradient")
}
fn crate_name() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients".split(':').next().unwrap())
}
fn module_path() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients")
}
}
impl bevy_reflect::Reflect for BackgroundGradient where {
#[inline]
fn into_any(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn ::core::any::Any> {
self
}
#[inline]
fn as_any(&self) -> &dyn ::core::any::Any { self }
#[inline]
fn as_any_mut(&mut self) -> &mut dyn ::core::any::Any { self }
#[inline]
fn into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect> {
self
}
#[inline]
fn as_reflect(&self) -> &dyn bevy_reflect::Reflect { self }
#[inline]
fn as_reflect_mut(&mut self) -> &mut dyn bevy_reflect::Reflect {
self
}
#[inline]
fn set(&mut self,
value:
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>)
->
::core::result::Result<(),
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>> {
*self = <dyn bevy_reflect::Reflect>::take(value)?;
::core::result::Result::Ok(())
}
}
#[allow(non_upper_case_globals)]
const _: () =
{
static __INVENTORY: ::inventory::Node =
::inventory::Node {
value: &{
bevy_reflect::__macro_exports::auto_register::AutomaticReflectRegistrations(<BackgroundGradient
as
bevy_reflect::__macro_exports::auto_register::RegisterForReflection>::__register)
},
next: ::inventory::__private::UnsafeCell::new(::inventory::__private::Option::None),
};
#[link_section = ".text.startup"]
unsafe extern "C" fn __ctor() {
unsafe {
::inventory::ErasedNode::submit(__INVENTORY.value,
&__INVENTORY)
}
}
#[used]
#[link_section = ".init_array"]
static __CTOR: unsafe extern "C" fn() = __ctor;
};
impl bevy_reflect::tuple_struct::TupleStruct for BackgroundGradient
where {
fn field(&self, index: usize)
-> ::core::option::Option<&dyn bevy_reflect::PartialReflect> {
match index {
0usize => ::core::option::Option::Some(&self.0),
_ => ::core::option::Option::None,
}
}
fn field_mut(&mut self, index: usize)
->
::core::option::Option<&mut dyn bevy_reflect::PartialReflect> {
match index {
0usize => ::core::option::Option::Some(&mut self.0),
_ => ::core::option::Option::None,
}
}
#[inline]
fn field_len(&self) -> usize { 1usize }
#[inline]
fn iter_fields(&self)
-> bevy_reflect::tuple_struct::TupleStructFieldIter {
bevy_reflect::tuple_struct::TupleStructFieldIter::new(self)
}
fn to_dynamic_tuple_struct(&self)
-> bevy_reflect::tuple_struct::DynamicTupleStruct {
let mut dynamic:
bevy_reflect::tuple_struct::DynamicTupleStruct =
::core::default::Default::default();
dynamic.set_represented_type(bevy_reflect::PartialReflect::get_represented_type_info(self));
dynamic.insert_boxed(bevy_reflect::PartialReflect::to_dynamic(&self.0));
dynamic
}
}
impl bevy_reflect::PartialReflect for BackgroundGradient where {
#[inline]
fn get_represented_type_info(&self)
-> ::core::option::Option<&'static bevy_reflect::TypeInfo> {
::core::option::Option::Some(<Self as
bevy_reflect::Typed>::type_info())
}
#[inline]
fn try_apply(&mut self, value: &dyn bevy_reflect::PartialReflect)
-> ::core::result::Result<(), bevy_reflect::ApplyError> {
if let bevy_reflect::ReflectRef::TupleStruct(struct_value) =
bevy_reflect::PartialReflect::reflect_ref(value) {
for (i, value) in
::core::iter::Iterator::enumerate(bevy_reflect::tuple_struct::TupleStruct::iter_fields(struct_value))
{
if let ::core::option::Option::Some(v) =
bevy_reflect::tuple_struct::TupleStruct::field_mut(self, i)
{
bevy_reflect::PartialReflect::try_apply(v, value)?;
}
}
} else {
return ::core::result::Result::Err(bevy_reflect::ApplyError::MismatchedKinds {
from_kind: bevy_reflect::PartialReflect::reflect_kind(value),
to_kind: bevy_reflect::ReflectKind::TupleStruct,
});
}
::core::result::Result::Ok(())
}
#[inline]
fn reflect_kind(&self) -> bevy_reflect::ReflectKind {
bevy_reflect::ReflectKind::TupleStruct
}
#[inline]
fn reflect_ref(&self) -> bevy_reflect::ReflectRef {
bevy_reflect::ReflectRef::TupleStruct(self)
}
#[inline]
fn reflect_mut(&mut self) -> bevy_reflect::ReflectMut {
bevy_reflect::ReflectMut::TupleStruct(self)
}
#[inline]
fn reflect_owned(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
-> bevy_reflect::ReflectOwned {
bevy_reflect::ReflectOwned::TupleStruct(self)
}
#[inline]
fn try_into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect>> {
::core::result::Result::Ok(self)
}
#[inline]
fn try_as_reflect(&self)
-> ::core::option::Option<&dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn try_as_reflect_mut(&mut self)
-> ::core::option::Option<&mut dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn into_partial_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect> {
self
}
#[inline]
fn as_partial_reflect(&self)
-> &dyn bevy_reflect::PartialReflect {
self
}
#[inline]
fn as_partial_reflect_mut(&mut self)
-> &mut dyn bevy_reflect::PartialReflect {
self
}
fn reflect_partial_eq(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<bool> {
let value =
<dyn bevy_reflect::PartialReflect>::try_downcast_ref::<Self>(value);
if let ::core::option::Option::Some(value) = value {
::core::option::Option::Some(::core::cmp::PartialEq::eq(self,
value))
} else { ::core::option::Option::Some(false) }
}
fn reflect_partial_cmp(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<::core::cmp::Ordering> {
(bevy_reflect::tuple_struct::tuple_struct_partial_cmp)(self,
value)
}
fn debug(&self, f: &mut ::core::fmt::Formatter<'_>)
-> ::core::fmt::Result {
::core::fmt::Debug::fmt(self, f)
}
#[inline]
fn reflect_clone(&self)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::ReflectCloneError> {
::core::result::Result::Ok(bevy_reflect::__macro_exports::alloc_utils::Box::new(::core::clone::Clone::clone(self)))
}
}
impl bevy_reflect::FromReflect for BackgroundGradient where {
fn from_reflect(reflect: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<Self> {
if let bevy_reflect::ReflectRef::TupleStruct(__ref_struct) =
bevy_reflect::PartialReflect::reflect_ref(reflect) {
let mut __this =
<Self as ::core::default::Default>::default();
if let ::core::option::Option::Some(__field) =
(||
<Vec<Gradient> as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::tuple_struct::TupleStruct::field(__ref_struct,
0)?))() {
__this.0 = __field;
}
::core::option::Option::Some(__this)
} else { ::core::option::Option::None }
}
}
};Reflect)]
527#[reflect(Component, Default, PartialEq, Debug, Clone)]
528#[cfg_attr(
529 feature = "serialize",
530 derive(#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl _serde::Serialize for BackgroundGradient {
fn serialize<__S>(&self, __serializer: __S)
-> _serde::__private228::Result<__S::Ok, __S::Error> where
__S: _serde::Serializer {
_serde::Serializer::serialize_newtype_struct(__serializer,
"BackgroundGradient", &self.0)
}
}
};serde::Serialize, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for BackgroundGradient {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
#[doc(hidden)]
struct __Visitor<'de> {
marker: _serde::__private228::PhantomData<BackgroundGradient>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __Visitor<'de> {
type Value = BackgroundGradient;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"tuple struct BackgroundGradient")
}
#[inline]
fn visit_newtype_struct<__E>(self, __e: __E)
-> _serde::__private228::Result<Self::Value, __E::Error>
where __E: _serde::Deserializer<'de> {
let __field0: Vec<Gradient> =
<Vec<Gradient> as _serde::Deserialize>::deserialize(__e)?;
_serde::__private228::Ok(BackgroundGradient(__field0))
}
#[inline]
fn visit_seq<__A>(self, mut __seq: __A)
-> _serde::__private228::Result<Self::Value, __A::Error>
where __A: _serde::de::SeqAccess<'de> {
let __field0 =
match _serde::de::SeqAccess::next_element::<Vec<Gradient>>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(0usize,
&"tuple struct BackgroundGradient with 1 element")),
};
_serde::__private228::Ok(BackgroundGradient(__field0))
}
}
_serde::Deserializer::deserialize_newtype_struct(__deserializer,
"BackgroundGradient",
__Visitor {
marker: _serde::__private228::PhantomData::<BackgroundGradient>,
lifetime: _serde::__private228::PhantomData,
})
}
}
};serde::Deserialize),
531 reflect(Serialize, Deserialize)
532)]
533pub struct BackgroundGradient(pub Vec<Gradient>);
535
536impl<T: Into<Gradient>> From<T> for BackgroundGradient {
537 fn from(value: T) -> Self {
538 Self(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
[value.into()]))vec![value.into()])
539 }
540}
541
542#[derive(impl bevy_ecs::component::Component for BorderGradient where
Self: ::core::marker::Send + ::core::marker::Sync + 'static {
const STORAGE_TYPE: bevy_ecs::component::StorageType =
bevy_ecs::component::StorageType::Table;
type Mutability = bevy_ecs::component::Mutable;
fn register_required_components(_requiree:
bevy_ecs::component::ComponentId,
required_components:
&mut bevy_ecs::component::RequiredComponentsRegistrator) {}
fn clone_behavior() -> bevy_ecs::component::ComponentCloneBehavior {
use bevy_ecs::component::{
DefaultCloneBehaviorBase, DefaultCloneBehaviorViaClone,
};
(&&&bevy_ecs::component::DefaultCloneBehaviorSpecialization::<Self>::default()).default_clone_behavior()
}
fn relationship_accessor()
->
::core::option::Option<bevy_ecs::relationship::ComponentRelationshipAccessor<Self>> {
::core::option::Option::None
}
}Component, #[automatically_derived]
impl ::core::clone::Clone for BorderGradient {
#[inline]
fn clone(&self) -> BorderGradient {
BorderGradient(::core::clone::Clone::clone(&self.0))
}
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for BorderGradient {
#[inline]
fn eq(&self, other: &BorderGradient) -> bool { self.0 == other.0 }
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for BorderGradient {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_tuple_field1_finish(f, "BorderGradient",
&&self.0)
}
}Debug, #[automatically_derived]
impl ::core::default::Default for BorderGradient {
#[inline]
fn default() -> BorderGradient {
BorderGradient(::core::default::Default::default())
}
}Default, const _: () =
{
impl bevy_reflect::GetTypeRegistration for BorderGradient where {
fn get_type_registration() -> bevy_reflect::TypeRegistration {
let mut registration =
bevy_reflect::TypeRegistration::of::<Self>();
registration.insert::<bevy_reflect::ReflectFromPtr>(bevy_reflect::FromType::<Self>::from_type());
registration.insert::<bevy_reflect::ReflectFromReflect>(bevy_reflect::FromType::<Self>::from_type());
registration.register_type_data::<ReflectComponent, Self>();
registration.register_type_data::<ReflectDefault, Self>();
registration.register_type_data::<ReflectSerialize, Self>();
registration.register_type_data::<ReflectDeserialize, Self>();
registration
}
#[inline(never)]
fn register_type_dependencies(registry:
&mut bevy_reflect::TypeRegistry) {
<Vec<Gradient> as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
}
}
impl bevy_reflect::Typed for BorderGradient where {
#[inline]
fn type_info() -> &'static bevy_reflect::TypeInfo {
static CELL: bevy_reflect::utility::NonGenericTypeInfoCell =
bevy_reflect::utility::NonGenericTypeInfoCell::new();
CELL.get_or_set(||
{
bevy_reflect::TypeInfo::TupleStruct(bevy_reflect::tuple_struct::TupleStructInfo::new::<Self>(&[bevy_reflect::UnnamedField::new::<Vec<Gradient>>(0usize)]))
})
}
}
#[allow(deprecated, reason =
"derives on a deprecated type shouldn't be considered a usage")]
impl bevy_reflect::TypePath for BorderGradient where {
fn type_path() -> &'static str {
"bevy_ui::gradients::BorderGradient"
}
fn short_type_path() -> &'static str { "BorderGradient" }
fn type_ident() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("BorderGradient")
}
fn crate_name() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients".split(':').next().unwrap())
}
fn module_path() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients")
}
}
impl bevy_reflect::Reflect for BorderGradient where {
#[inline]
fn into_any(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn ::core::any::Any> {
self
}
#[inline]
fn as_any(&self) -> &dyn ::core::any::Any { self }
#[inline]
fn as_any_mut(&mut self) -> &mut dyn ::core::any::Any { self }
#[inline]
fn into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect> {
self
}
#[inline]
fn as_reflect(&self) -> &dyn bevy_reflect::Reflect { self }
#[inline]
fn as_reflect_mut(&mut self) -> &mut dyn bevy_reflect::Reflect {
self
}
#[inline]
fn set(&mut self,
value:
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>)
->
::core::result::Result<(),
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>> {
*self = <dyn bevy_reflect::Reflect>::take(value)?;
::core::result::Result::Ok(())
}
}
#[allow(non_upper_case_globals)]
const _: () =
{
static __INVENTORY: ::inventory::Node =
::inventory::Node {
value: &{
bevy_reflect::__macro_exports::auto_register::AutomaticReflectRegistrations(<BorderGradient
as
bevy_reflect::__macro_exports::auto_register::RegisterForReflection>::__register)
},
next: ::inventory::__private::UnsafeCell::new(::inventory::__private::Option::None),
};
#[link_section = ".text.startup"]
unsafe extern "C" fn __ctor() {
unsafe {
::inventory::ErasedNode::submit(__INVENTORY.value,
&__INVENTORY)
}
}
#[used]
#[link_section = ".init_array"]
static __CTOR: unsafe extern "C" fn() = __ctor;
};
impl bevy_reflect::tuple_struct::TupleStruct for BorderGradient where
{
fn field(&self, index: usize)
-> ::core::option::Option<&dyn bevy_reflect::PartialReflect> {
match index {
0usize => ::core::option::Option::Some(&self.0),
_ => ::core::option::Option::None,
}
}
fn field_mut(&mut self, index: usize)
->
::core::option::Option<&mut dyn bevy_reflect::PartialReflect> {
match index {
0usize => ::core::option::Option::Some(&mut self.0),
_ => ::core::option::Option::None,
}
}
#[inline]
fn field_len(&self) -> usize { 1usize }
#[inline]
fn iter_fields(&self)
-> bevy_reflect::tuple_struct::TupleStructFieldIter {
bevy_reflect::tuple_struct::TupleStructFieldIter::new(self)
}
fn to_dynamic_tuple_struct(&self)
-> bevy_reflect::tuple_struct::DynamicTupleStruct {
let mut dynamic:
bevy_reflect::tuple_struct::DynamicTupleStruct =
::core::default::Default::default();
dynamic.set_represented_type(bevy_reflect::PartialReflect::get_represented_type_info(self));
dynamic.insert_boxed(bevy_reflect::PartialReflect::to_dynamic(&self.0));
dynamic
}
}
impl bevy_reflect::PartialReflect for BorderGradient where {
#[inline]
fn get_represented_type_info(&self)
-> ::core::option::Option<&'static bevy_reflect::TypeInfo> {
::core::option::Option::Some(<Self as
bevy_reflect::Typed>::type_info())
}
#[inline]
fn try_apply(&mut self, value: &dyn bevy_reflect::PartialReflect)
-> ::core::result::Result<(), bevy_reflect::ApplyError> {
if let bevy_reflect::ReflectRef::TupleStruct(struct_value) =
bevy_reflect::PartialReflect::reflect_ref(value) {
for (i, value) in
::core::iter::Iterator::enumerate(bevy_reflect::tuple_struct::TupleStruct::iter_fields(struct_value))
{
if let ::core::option::Option::Some(v) =
bevy_reflect::tuple_struct::TupleStruct::field_mut(self, i)
{
bevy_reflect::PartialReflect::try_apply(v, value)?;
}
}
} else {
return ::core::result::Result::Err(bevy_reflect::ApplyError::MismatchedKinds {
from_kind: bevy_reflect::PartialReflect::reflect_kind(value),
to_kind: bevy_reflect::ReflectKind::TupleStruct,
});
}
::core::result::Result::Ok(())
}
#[inline]
fn reflect_kind(&self) -> bevy_reflect::ReflectKind {
bevy_reflect::ReflectKind::TupleStruct
}
#[inline]
fn reflect_ref(&self) -> bevy_reflect::ReflectRef {
bevy_reflect::ReflectRef::TupleStruct(self)
}
#[inline]
fn reflect_mut(&mut self) -> bevy_reflect::ReflectMut {
bevy_reflect::ReflectMut::TupleStruct(self)
}
#[inline]
fn reflect_owned(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
-> bevy_reflect::ReflectOwned {
bevy_reflect::ReflectOwned::TupleStruct(self)
}
#[inline]
fn try_into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect>> {
::core::result::Result::Ok(self)
}
#[inline]
fn try_as_reflect(&self)
-> ::core::option::Option<&dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn try_as_reflect_mut(&mut self)
-> ::core::option::Option<&mut dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn into_partial_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect> {
self
}
#[inline]
fn as_partial_reflect(&self)
-> &dyn bevy_reflect::PartialReflect {
self
}
#[inline]
fn as_partial_reflect_mut(&mut self)
-> &mut dyn bevy_reflect::PartialReflect {
self
}
fn reflect_partial_eq(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<bool> {
let value =
<dyn bevy_reflect::PartialReflect>::try_downcast_ref::<Self>(value);
if let ::core::option::Option::Some(value) = value {
::core::option::Option::Some(::core::cmp::PartialEq::eq(self,
value))
} else { ::core::option::Option::Some(false) }
}
fn reflect_partial_cmp(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<::core::cmp::Ordering> {
(bevy_reflect::tuple_struct::tuple_struct_partial_cmp)(self,
value)
}
fn debug(&self, f: &mut ::core::fmt::Formatter<'_>)
-> ::core::fmt::Result {
::core::fmt::Debug::fmt(self, f)
}
#[inline]
fn reflect_clone(&self)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::ReflectCloneError> {
::core::result::Result::Ok(bevy_reflect::__macro_exports::alloc_utils::Box::new(::core::clone::Clone::clone(self)))
}
}
impl bevy_reflect::FromReflect for BorderGradient where {
fn from_reflect(reflect: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<Self> {
if let bevy_reflect::ReflectRef::TupleStruct(__ref_struct) =
bevy_reflect::PartialReflect::reflect_ref(reflect) {
let mut __this =
<Self as ::core::default::Default>::default();
if let ::core::option::Option::Some(__field) =
(||
<Vec<Gradient> as
bevy_reflect::FromReflect>::from_reflect(bevy_reflect::tuple_struct::TupleStruct::field(__ref_struct,
0)?))() {
__this.0 = __field;
}
::core::option::Option::Some(__this)
} else { ::core::option::Option::None }
}
}
};Reflect)]
543#[reflect(Component, Default, PartialEq, Debug, Clone)]
544#[cfg_attr(
545 feature = "serialize",
546 derive(#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl _serde::Serialize for BorderGradient {
fn serialize<__S>(&self, __serializer: __S)
-> _serde::__private228::Result<__S::Ok, __S::Error> where
__S: _serde::Serializer {
_serde::Serializer::serialize_newtype_struct(__serializer,
"BorderGradient", &self.0)
}
}
};serde::Serialize, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for BorderGradient {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
#[doc(hidden)]
struct __Visitor<'de> {
marker: _serde::__private228::PhantomData<BorderGradient>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __Visitor<'de> {
type Value = BorderGradient;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"tuple struct BorderGradient")
}
#[inline]
fn visit_newtype_struct<__E>(self, __e: __E)
-> _serde::__private228::Result<Self::Value, __E::Error>
where __E: _serde::Deserializer<'de> {
let __field0: Vec<Gradient> =
<Vec<Gradient> as _serde::Deserialize>::deserialize(__e)?;
_serde::__private228::Ok(BorderGradient(__field0))
}
#[inline]
fn visit_seq<__A>(self, mut __seq: __A)
-> _serde::__private228::Result<Self::Value, __A::Error>
where __A: _serde::de::SeqAccess<'de> {
let __field0 =
match _serde::de::SeqAccess::next_element::<Vec<Gradient>>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(0usize,
&"tuple struct BorderGradient with 1 element")),
};
_serde::__private228::Ok(BorderGradient(__field0))
}
}
_serde::Deserializer::deserialize_newtype_struct(__deserializer,
"BorderGradient",
__Visitor {
marker: _serde::__private228::PhantomData::<BorderGradient>,
lifetime: _serde::__private228::PhantomData,
})
}
}
};serde::Deserialize),
547 reflect(Serialize, Deserialize)
548)]
549pub struct BorderGradient(pub Vec<Gradient>);
551
552impl<T: Into<Gradient>> From<T> for BorderGradient {
553 fn from(value: T) -> Self {
554 Self(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
[value.into()]))vec![value.into()])
555 }
556}
557
558#[derive(#[automatically_derived]
impl ::core::default::Default for RadialGradientShape {
#[inline]
fn default() -> RadialGradientShape { Self::ClosestCorner }
}Default, #[automatically_derived]
impl ::core::marker::Copy for RadialGradientShape { }Copy, #[automatically_derived]
impl ::core::clone::Clone for RadialGradientShape {
#[inline]
fn clone(&self) -> RadialGradientShape {
let _: ::core::clone::AssertParamIsClone<Val>;
*self
}
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for RadialGradientShape {
#[inline]
fn eq(&self, other: &RadialGradientShape) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(RadialGradientShape::Circle(__self_0),
RadialGradientShape::Circle(__arg1_0)) =>
__self_0 == __arg1_0,
(RadialGradientShape::Ellipse(__self_0, __self_1),
RadialGradientShape::Ellipse(__arg1_0, __arg1_1)) =>
__self_0 == __arg1_0 && __self_1 == __arg1_1,
_ => true,
}
}
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for RadialGradientShape {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
RadialGradientShape::ClosestSide =>
::core::fmt::Formatter::write_str(f, "ClosestSide"),
RadialGradientShape::FarthestSide =>
::core::fmt::Formatter::write_str(f, "FarthestSide"),
RadialGradientShape::ClosestCorner =>
::core::fmt::Formatter::write_str(f, "ClosestCorner"),
RadialGradientShape::FarthestCorner =>
::core::fmt::Formatter::write_str(f, "FarthestCorner"),
RadialGradientShape::Circle(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Circle",
&__self_0),
RadialGradientShape::Ellipse(__self_0, __self_1) =>
::core::fmt::Formatter::debug_tuple_field2_finish(f,
"Ellipse", __self_0, &__self_1),
}
}
}Debug, const _: () =
{
impl bevy_reflect::GetTypeRegistration for RadialGradientShape where
{
fn get_type_registration() -> bevy_reflect::TypeRegistration {
let mut registration =
bevy_reflect::TypeRegistration::of::<Self>();
registration.insert::<bevy_reflect::ReflectFromPtr>(bevy_reflect::FromType::<Self>::from_type());
registration.insert::<bevy_reflect::ReflectFromReflect>(bevy_reflect::FromType::<Self>::from_type());
registration.register_type_data::<ReflectDefault, Self>();
registration.register_type_data::<ReflectSerialize, Self>();
registration.register_type_data::<ReflectDeserialize, Self>();
registration
}
#[inline(never)]
fn register_type_dependencies(registry:
&mut bevy_reflect::TypeRegistry) {
<Val as
bevy_reflect::__macro_exports::RegisterForReflection>::__register(registry);
}
}
impl bevy_reflect::Typed for RadialGradientShape where {
#[inline]
fn type_info() -> &'static bevy_reflect::TypeInfo {
static CELL: bevy_reflect::utility::NonGenericTypeInfoCell =
bevy_reflect::utility::NonGenericTypeInfoCell::new();
CELL.get_or_set(||
{
bevy_reflect::TypeInfo::Enum(bevy_reflect::enums::EnumInfo::new::<Self>(&[bevy_reflect::enums::VariantInfo::Unit(bevy_reflect::enums::UnitVariantInfo::new("ClosestSide")),
bevy_reflect::enums::VariantInfo::Unit(bevy_reflect::enums::UnitVariantInfo::new("FarthestSide")),
bevy_reflect::enums::VariantInfo::Unit(bevy_reflect::enums::UnitVariantInfo::new("ClosestCorner")),
bevy_reflect::enums::VariantInfo::Unit(bevy_reflect::enums::UnitVariantInfo::new("FarthestCorner")),
bevy_reflect::enums::VariantInfo::Tuple(bevy_reflect::enums::TupleVariantInfo::new("Circle",
&[bevy_reflect::UnnamedField::new::<Val>(0usize)])),
bevy_reflect::enums::VariantInfo::Tuple(bevy_reflect::enums::TupleVariantInfo::new("Ellipse",
&[bevy_reflect::UnnamedField::new::<Val>(0usize),
bevy_reflect::UnnamedField::new::<Val>(1usize)]))]))
})
}
}
#[allow(deprecated, reason =
"derives on a deprecated type shouldn't be considered a usage")]
impl bevy_reflect::TypePath for RadialGradientShape where {
fn type_path() -> &'static str {
"bevy_ui::gradients::RadialGradientShape"
}
fn short_type_path() -> &'static str { "RadialGradientShape" }
fn type_ident() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("RadialGradientShape")
}
fn crate_name() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients".split(':').next().unwrap())
}
fn module_path() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients")
}
}
impl bevy_reflect::Reflect for RadialGradientShape where {
#[inline]
fn into_any(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn ::core::any::Any> {
self
}
#[inline]
fn as_any(&self) -> &dyn ::core::any::Any { self }
#[inline]
fn as_any_mut(&mut self) -> &mut dyn ::core::any::Any { self }
#[inline]
fn into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect> {
self
}
#[inline]
fn as_reflect(&self) -> &dyn bevy_reflect::Reflect { self }
#[inline]
fn as_reflect_mut(&mut self) -> &mut dyn bevy_reflect::Reflect {
self
}
#[inline]
fn set(&mut self,
value:
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>)
->
::core::result::Result<(),
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>> {
*self = <dyn bevy_reflect::Reflect>::take(value)?;
::core::result::Result::Ok(())
}
}
#[allow(non_upper_case_globals)]
const _: () =
{
static __INVENTORY: ::inventory::Node =
::inventory::Node {
value: &{
bevy_reflect::__macro_exports::auto_register::AutomaticReflectRegistrations(<RadialGradientShape
as
bevy_reflect::__macro_exports::auto_register::RegisterForReflection>::__register)
},
next: ::inventory::__private::UnsafeCell::new(::inventory::__private::Option::None),
};
#[link_section = ".text.startup"]
unsafe extern "C" fn __ctor() {
unsafe {
::inventory::ErasedNode::submit(__INVENTORY.value,
&__INVENTORY)
}
}
#[used]
#[link_section = ".init_array"]
static __CTOR: unsafe extern "C" fn() = __ctor;
};
impl bevy_reflect::enums::Enum for RadialGradientShape where {
fn field(&self, __name_param: &str)
-> ::core::option::Option<&dyn bevy_reflect::PartialReflect> {
match self { _ => ::core::option::Option::None, }
}
fn field_at(&self, __index_param: usize)
-> ::core::option::Option<&dyn bevy_reflect::PartialReflect> {
match self {
RadialGradientShape::Circle { 0: __value, .. } if
__index_param == 0usize =>
::core::option::Option::Some(__value),
RadialGradientShape::Ellipse { 0: __value, .. } if
__index_param == 0usize =>
::core::option::Option::Some(__value),
RadialGradientShape::Ellipse { 1: __value, .. } if
__index_param == 1usize =>
::core::option::Option::Some(__value),
_ => ::core::option::Option::None,
}
}
fn field_mut(&mut self, __name_param: &str)
->
::core::option::Option<&mut dyn bevy_reflect::PartialReflect> {
match self { _ => ::core::option::Option::None, }
}
fn field_at_mut(&mut self, __index_param: usize)
->
::core::option::Option<&mut dyn bevy_reflect::PartialReflect> {
match self {
RadialGradientShape::Circle { 0: __value, .. } if
__index_param == 0usize =>
::core::option::Option::Some(__value),
RadialGradientShape::Ellipse { 0: __value, .. } if
__index_param == 0usize =>
::core::option::Option::Some(__value),
RadialGradientShape::Ellipse { 1: __value, .. } if
__index_param == 1usize =>
::core::option::Option::Some(__value),
_ => ::core::option::Option::None,
}
}
fn index_of(&self, __name_param: &str)
-> ::core::option::Option<usize> {
match self { _ => ::core::option::Option::None, }
}
fn name_at(&self, __index_param: usize)
-> ::core::option::Option<&str> {
match self { _ => ::core::option::Option::None, }
}
fn iter_fields(&self) -> bevy_reflect::enums::VariantFieldIter {
bevy_reflect::enums::VariantFieldIter::new(self)
}
#[inline]
fn field_len(&self) -> usize {
match self {
RadialGradientShape::ClosestSide { .. } => 0usize,
RadialGradientShape::FarthestSide { .. } => 0usize,
RadialGradientShape::ClosestCorner { .. } => 0usize,
RadialGradientShape::FarthestCorner { .. } => 0usize,
RadialGradientShape::Circle { .. } => 1usize,
RadialGradientShape::Ellipse { .. } => 2usize,
_ => 0,
}
}
#[inline]
fn variant_name(&self) -> &str {
match self {
RadialGradientShape::ClosestSide { .. } => "ClosestSide",
RadialGradientShape::FarthestSide { .. } => "FarthestSide",
RadialGradientShape::ClosestCorner { .. } =>
"ClosestCorner",
RadialGradientShape::FarthestCorner { .. } =>
"FarthestCorner",
RadialGradientShape::Circle { .. } => "Circle",
RadialGradientShape::Ellipse { .. } => "Ellipse",
_ =>
::core::panicking::panic("internal error: entered unreachable code"),
}
}
#[inline]
fn variant_index(&self) -> usize {
match self {
RadialGradientShape::ClosestSide { .. } => 0usize,
RadialGradientShape::FarthestSide { .. } => 1usize,
RadialGradientShape::ClosestCorner { .. } => 2usize,
RadialGradientShape::FarthestCorner { .. } => 3usize,
RadialGradientShape::Circle { .. } => 4usize,
RadialGradientShape::Ellipse { .. } => 5usize,
_ =>
::core::panicking::panic("internal error: entered unreachable code"),
}
}
#[inline]
fn variant_type(&self) -> bevy_reflect::enums::VariantType {
match self {
RadialGradientShape::ClosestSide { .. } =>
bevy_reflect::enums::VariantType::Unit,
RadialGradientShape::FarthestSide { .. } =>
bevy_reflect::enums::VariantType::Unit,
RadialGradientShape::ClosestCorner { .. } =>
bevy_reflect::enums::VariantType::Unit,
RadialGradientShape::FarthestCorner { .. } =>
bevy_reflect::enums::VariantType::Unit,
RadialGradientShape::Circle { .. } =>
bevy_reflect::enums::VariantType::Tuple,
RadialGradientShape::Ellipse { .. } =>
bevy_reflect::enums::VariantType::Tuple,
_ =>
::core::panicking::panic("internal error: entered unreachable code"),
}
}
fn to_dynamic_enum(&self) -> bevy_reflect::enums::DynamicEnum {
bevy_reflect::enums::DynamicEnum::from_ref::<Self>(self)
}
}
impl bevy_reflect::PartialReflect for RadialGradientShape where {
#[inline]
fn get_represented_type_info(&self)
-> ::core::option::Option<&'static bevy_reflect::TypeInfo> {
::core::option::Option::Some(<Self as
bevy_reflect::Typed>::type_info())
}
#[inline]
fn try_apply(&mut self,
__value_param: &dyn bevy_reflect::PartialReflect)
-> ::core::result::Result<(), bevy_reflect::ApplyError> {
if let bevy_reflect::ReflectRef::Enum(__value_param) =
bevy_reflect::PartialReflect::reflect_ref(__value_param) {
if bevy_reflect::enums::Enum::variant_name(self) ==
bevy_reflect::enums::Enum::variant_name(__value_param) {
match bevy_reflect::enums::Enum::variant_type(__value_param)
{
bevy_reflect::enums::VariantType::Struct => {
for field in
bevy_reflect::enums::Enum::iter_fields(__value_param) {
let name = field.name().unwrap();
if let ::core::option::Option::Some(v) =
bevy_reflect::enums::Enum::field_mut(self, name) {
bevy_reflect::PartialReflect::try_apply(v, field.value())?;
}
}
}
bevy_reflect::enums::VariantType::Tuple => {
for (index, field) in
::core::iter::Iterator::enumerate(bevy_reflect::enums::Enum::iter_fields(__value_param))
{
if let ::core::option::Option::Some(v) =
bevy_reflect::enums::Enum::field_at_mut(self, index) {
bevy_reflect::PartialReflect::try_apply(v, field.value())?;
}
}
}
_ => {}
}
} else {
match bevy_reflect::enums::Enum::variant_name(__value_param)
{
"ClosestSide" => {
*self = RadialGradientShape::ClosestSide {}
}
"FarthestSide" => {
*self = RadialGradientShape::FarthestSide {}
}
"ClosestCorner" => {
*self = RadialGradientShape::ClosestCorner {}
}
"FarthestCorner" => {
*self = RadialGradientShape::FarthestCorner {}
}
"Circle" => {
*self =
RadialGradientShape::Circle {
0: {
let __0 = __value_param.field_at(0usize);
let __0 =
__0.ok_or(bevy_reflect::ApplyError::MissingEnumField {
variant_name: ::core::convert::Into::into("Circle"),
field_name: ::core::convert::Into::into(".0"),
})?;
<Val as
bevy_reflect::FromReflect>::from_reflect(__0).ok_or(bevy_reflect::ApplyError::MismatchedTypes {
from_type: ::core::convert::Into::into(bevy_reflect::DynamicTypePath::reflect_type_path(__0)),
to_type: ::core::convert::Into::into(<Val as
bevy_reflect::TypePath>::type_path()),
})?
},
}
}
"Ellipse" => {
*self =
RadialGradientShape::Ellipse {
0: {
let __0 = __value_param.field_at(0usize);
let __0 =
__0.ok_or(bevy_reflect::ApplyError::MissingEnumField {
variant_name: ::core::convert::Into::into("Ellipse"),
field_name: ::core::convert::Into::into(".0"),
})?;
<Val as
bevy_reflect::FromReflect>::from_reflect(__0).ok_or(bevy_reflect::ApplyError::MismatchedTypes {
from_type: ::core::convert::Into::into(bevy_reflect::DynamicTypePath::reflect_type_path(__0)),
to_type: ::core::convert::Into::into(<Val as
bevy_reflect::TypePath>::type_path()),
})?
},
1: {
let __1 = __value_param.field_at(1usize);
let __1 =
__1.ok_or(bevy_reflect::ApplyError::MissingEnumField {
variant_name: ::core::convert::Into::into("Ellipse"),
field_name: ::core::convert::Into::into(".1"),
})?;
<Val as
bevy_reflect::FromReflect>::from_reflect(__1).ok_or(bevy_reflect::ApplyError::MismatchedTypes {
from_type: ::core::convert::Into::into(bevy_reflect::DynamicTypePath::reflect_type_path(__1)),
to_type: ::core::convert::Into::into(<Val as
bevy_reflect::TypePath>::type_path()),
})?
},
}
}
name => {
return ::core::result::Result::Err(bevy_reflect::ApplyError::UnknownVariant {
enum_name: ::core::convert::Into::into(bevy_reflect::DynamicTypePath::reflect_type_path(self)),
variant_name: ::core::convert::Into::into(name),
});
}
}
}
} else {
return ::core::result::Result::Err(bevy_reflect::ApplyError::MismatchedKinds {
from_kind: bevy_reflect::PartialReflect::reflect_kind(__value_param),
to_kind: bevy_reflect::ReflectKind::Enum,
});
}
::core::result::Result::Ok(())
}
fn reflect_kind(&self) -> bevy_reflect::ReflectKind {
bevy_reflect::ReflectKind::Enum
}
fn reflect_ref(&self) -> bevy_reflect::ReflectRef {
bevy_reflect::ReflectRef::Enum(self)
}
fn reflect_mut(&mut self) -> bevy_reflect::ReflectMut {
bevy_reflect::ReflectMut::Enum(self)
}
fn reflect_owned(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
-> bevy_reflect::ReflectOwned {
bevy_reflect::ReflectOwned::Enum(self)
}
#[inline]
fn try_into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect>> {
::core::result::Result::Ok(self)
}
#[inline]
fn try_as_reflect(&self)
-> ::core::option::Option<&dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn try_as_reflect_mut(&mut self)
-> ::core::option::Option<&mut dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn into_partial_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect> {
self
}
#[inline]
fn as_partial_reflect(&self)
-> &dyn bevy_reflect::PartialReflect {
self
}
#[inline]
fn as_partial_reflect_mut(&mut self)
-> &mut dyn bevy_reflect::PartialReflect {
self
}
fn reflect_hash(&self) -> ::core::option::Option<u64> {
(bevy_reflect::enums::enum_hash)(self)
}
fn reflect_partial_eq(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<bool> {
let value =
<dyn bevy_reflect::PartialReflect>::try_downcast_ref::<Self>(value);
if let ::core::option::Option::Some(value) = value {
::core::option::Option::Some(::core::cmp::PartialEq::eq(self,
value))
} else { ::core::option::Option::Some(false) }
}
fn reflect_partial_cmp(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<::core::cmp::Ordering> {
(bevy_reflect::enums::enum_partial_cmp)(self, value)
}
#[inline]
#[allow(unreachable_code, reason =
"Ignored fields without a `clone` attribute will early-return with an error")]
fn reflect_clone(&self)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::ReflectCloneError> {
let this = self;
::core::result::Result::Ok(bevy_reflect::__macro_exports::alloc_utils::Box::new(match this
{
RadialGradientShape::ClosestSide {} =>
RadialGradientShape::ClosestSide {},
RadialGradientShape::FarthestSide {} =>
RadialGradientShape::FarthestSide {},
RadialGradientShape::ClosestCorner {} =>
RadialGradientShape::ClosestCorner {},
RadialGradientShape::FarthestCorner {} =>
RadialGradientShape::FarthestCorner {},
RadialGradientShape::Circle { 0: __0 } =>
RadialGradientShape::Circle {
0: <Val as
bevy_reflect::PartialReflect>::reflect_clone_and_take(__0)?,
},
RadialGradientShape::Ellipse { 0: __0, 1: __1 } =>
RadialGradientShape::Ellipse {
0: <Val as
bevy_reflect::PartialReflect>::reflect_clone_and_take(__0)?,
1: <Val as
bevy_reflect::PartialReflect>::reflect_clone_and_take(__1)?,
},
}))
}
}
impl bevy_reflect::FromReflect for RadialGradientShape where {
fn from_reflect(__param0: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<Self> {
if let bevy_reflect::ReflectRef::Enum(__param0) =
bevy_reflect::PartialReflect::reflect_ref(__param0) {
match bevy_reflect::enums::Enum::variant_name(__param0) {
"ClosestSide" =>
::core::option::Option::Some(RadialGradientShape::ClosestSide {}),
"FarthestSide" =>
::core::option::Option::Some(RadialGradientShape::FarthestSide {}),
"ClosestCorner" =>
::core::option::Option::Some(RadialGradientShape::ClosestCorner {}),
"FarthestCorner" =>
::core::option::Option::Some(RadialGradientShape::FarthestCorner {}),
"Circle" =>
::core::option::Option::Some(RadialGradientShape::Circle {
0: {
let __0 = __param0.field_at(0usize);
let __0 = __0?;
<Val as bevy_reflect::FromReflect>::from_reflect(__0)?
},
}),
"Ellipse" =>
::core::option::Option::Some(RadialGradientShape::Ellipse {
0: {
let __0 = __param0.field_at(0usize);
let __0 = __0?;
<Val as bevy_reflect::FromReflect>::from_reflect(__0)?
},
1: {
let __1 = __param0.field_at(1usize);
let __1 = __1?;
<Val as bevy_reflect::FromReflect>::from_reflect(__1)?
},
}),
name => ::core::option::Option::None,
}
} else { ::core::option::Option::None }
}
}
};Reflect)]
559#[reflect(PartialEq, Default)]
560#[cfg_attr(
561 feature = "serialize",
562 derive(#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl _serde::Serialize for RadialGradientShape {
fn serialize<__S>(&self, __serializer: __S)
-> _serde::__private228::Result<__S::Ok, __S::Error> where
__S: _serde::Serializer {
match *self {
RadialGradientShape::ClosestSide =>
_serde::Serializer::serialize_unit_variant(__serializer,
"RadialGradientShape", 0u32, "ClosestSide"),
RadialGradientShape::FarthestSide =>
_serde::Serializer::serialize_unit_variant(__serializer,
"RadialGradientShape", 1u32, "FarthestSide"),
RadialGradientShape::ClosestCorner =>
_serde::Serializer::serialize_unit_variant(__serializer,
"RadialGradientShape", 2u32, "ClosestCorner"),
RadialGradientShape::FarthestCorner =>
_serde::Serializer::serialize_unit_variant(__serializer,
"RadialGradientShape", 3u32, "FarthestCorner"),
RadialGradientShape::Circle(ref __field0) =>
_serde::Serializer::serialize_newtype_variant(__serializer,
"RadialGradientShape", 4u32, "Circle", __field0),
RadialGradientShape::Ellipse(ref __field0, ref __field1) =>
{
let mut __serde_state =
_serde::Serializer::serialize_tuple_variant(__serializer,
"RadialGradientShape", 5u32, "Ellipse", 0 + 1 + 1)?;
_serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
__field0)?;
_serde::ser::SerializeTupleVariant::serialize_field(&mut __serde_state,
__field1)?;
_serde::ser::SerializeTupleVariant::end(__serde_state)
}
}
}
}
};serde::Serialize, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for RadialGradientShape {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
#[allow(non_camel_case_types)]
#[doc(hidden)]
enum __Field {
__field0,
__field1,
__field2,
__field3,
__field4,
__field5,
}
#[doc(hidden)]
struct __FieldVisitor;
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
type Value = __Field;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"variant identifier")
}
fn visit_u64<__E>(self, __value: u64)
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
0u64 => _serde::__private228::Ok(__Field::__field0),
1u64 => _serde::__private228::Ok(__Field::__field1),
2u64 => _serde::__private228::Ok(__Field::__field2),
3u64 => _serde::__private228::Ok(__Field::__field3),
4u64 => _serde::__private228::Ok(__Field::__field4),
5u64 => _serde::__private228::Ok(__Field::__field5),
_ =>
_serde::__private228::Err(_serde::de::Error::invalid_value(_serde::de::Unexpected::Unsigned(__value),
&"variant index 0 <= i < 6")),
}
}
fn visit_str<__E>(self, __value: &str)
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
"ClosestSide" =>
_serde::__private228::Ok(__Field::__field0),
"FarthestSide" =>
_serde::__private228::Ok(__Field::__field1),
"ClosestCorner" =>
_serde::__private228::Ok(__Field::__field2),
"FarthestCorner" =>
_serde::__private228::Ok(__Field::__field3),
"Circle" => _serde::__private228::Ok(__Field::__field4),
"Ellipse" => _serde::__private228::Ok(__Field::__field5),
_ => {
_serde::__private228::Err(_serde::de::Error::unknown_variant(__value,
VARIANTS))
}
}
}
fn visit_bytes<__E>(self, __value: &[u8])
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
b"ClosestSide" =>
_serde::__private228::Ok(__Field::__field0),
b"FarthestSide" =>
_serde::__private228::Ok(__Field::__field1),
b"ClosestCorner" =>
_serde::__private228::Ok(__Field::__field2),
b"FarthestCorner" =>
_serde::__private228::Ok(__Field::__field3),
b"Circle" => _serde::__private228::Ok(__Field::__field4),
b"Ellipse" => _serde::__private228::Ok(__Field::__field5),
_ => {
let __value =
&_serde::__private228::from_utf8_lossy(__value);
_serde::__private228::Err(_serde::de::Error::unknown_variant(__value,
VARIANTS))
}
}
}
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::Deserializer::deserialize_identifier(__deserializer,
__FieldVisitor)
}
}
#[doc(hidden)]
struct __Visitor<'de> {
marker: _serde::__private228::PhantomData<RadialGradientShape>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __Visitor<'de> {
type Value = RadialGradientShape;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"enum RadialGradientShape")
}
fn visit_enum<__A>(self, __data: __A)
-> _serde::__private228::Result<Self::Value, __A::Error>
where __A: _serde::de::EnumAccess<'de> {
match _serde::de::EnumAccess::variant(__data)? {
(__Field::__field0, __variant) => {
_serde::de::VariantAccess::unit_variant(__variant)?;
_serde::__private228::Ok(RadialGradientShape::ClosestSide)
}
(__Field::__field1, __variant) => {
_serde::de::VariantAccess::unit_variant(__variant)?;
_serde::__private228::Ok(RadialGradientShape::FarthestSide)
}
(__Field::__field2, __variant) => {
_serde::de::VariantAccess::unit_variant(__variant)?;
_serde::__private228::Ok(RadialGradientShape::ClosestCorner)
}
(__Field::__field3, __variant) => {
_serde::de::VariantAccess::unit_variant(__variant)?;
_serde::__private228::Ok(RadialGradientShape::FarthestCorner)
}
(__Field::__field4, __variant) =>
_serde::__private228::Result::map(_serde::de::VariantAccess::newtype_variant::<Val>(__variant),
RadialGradientShape::Circle),
(__Field::__field5, __variant) => {
#[doc(hidden)]
struct __Visitor<'de> {
marker: _serde::__private228::PhantomData<RadialGradientShape>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __Visitor<'de> {
type Value = RadialGradientShape;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"tuple variant RadialGradientShape::Ellipse")
}
#[inline]
fn visit_seq<__A>(self, mut __seq: __A)
-> _serde::__private228::Result<Self::Value, __A::Error>
where __A: _serde::de::SeqAccess<'de> {
let __field0 =
match _serde::de::SeqAccess::next_element::<Val>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(0usize,
&"tuple variant RadialGradientShape::Ellipse with 2 elements")),
};
let __field1 =
match _serde::de::SeqAccess::next_element::<Val>(&mut __seq)?
{
_serde::__private228::Some(__value) => __value,
_serde::__private228::None =>
return _serde::__private228::Err(_serde::de::Error::invalid_length(1usize,
&"tuple variant RadialGradientShape::Ellipse with 2 elements")),
};
_serde::__private228::Ok(RadialGradientShape::Ellipse(__field0,
__field1))
}
}
_serde::de::VariantAccess::tuple_variant(__variant, 2usize,
__Visitor {
marker: _serde::__private228::PhantomData::<RadialGradientShape>,
lifetime: _serde::__private228::PhantomData,
})
}
}
}
}
#[doc(hidden)]
const VARIANTS: &'static [&'static str] =
&["ClosestSide", "FarthestSide", "ClosestCorner",
"FarthestCorner", "Circle", "Ellipse"];
_serde::Deserializer::deserialize_enum(__deserializer,
"RadialGradientShape", VARIANTS,
__Visitor {
marker: _serde::__private228::PhantomData::<RadialGradientShape>,
lifetime: _serde::__private228::PhantomData,
})
}
}
};serde::Deserialize),
563 reflect(Serialize, Deserialize)
564)]
565pub enum RadialGradientShape {
566 ClosestSide,
568 FarthestSide,
570 #[default]
572 ClosestCorner,
573 FarthestCorner,
575 Circle(Val),
577 Ellipse(Val, Val),
579}
580
581const fn close_side(p: f32, h: f32) -> f32 {
582 (-h - p).abs().min((h - p).abs())
583}
584
585const fn far_side(p: f32, h: f32) -> f32 {
586 (-h - p).abs().max((h - p).abs())
587}
588
589const fn close_side2(p: Vec2, h: Vec2) -> f32 {
590 close_side(p.x, h.x).min(close_side(p.y, h.y))
591}
592
593const fn far_side2(p: Vec2, h: Vec2) -> f32 {
594 far_side(p.x, h.x).max(far_side(p.y, h.y))
595}
596
597impl RadialGradientShape {
598 pub fn resolve(
600 self,
601 position: Vec2,
602 scale_factor: f32,
603 physical_size: Vec2,
604 physical_target_size: Vec2,
605 ) -> Vec2 {
606 let half_size = 0.5 * physical_size;
607 match self {
608 RadialGradientShape::ClosestSide => Vec2::splat(close_side2(position, half_size)),
609 RadialGradientShape::FarthestSide => Vec2::splat(far_side2(position, half_size)),
610 RadialGradientShape::ClosestCorner => Vec2::new(
611 close_side(position.x, half_size.x),
612 close_side(position.y, half_size.y),
613 ),
614 RadialGradientShape::FarthestCorner => Vec2::new(
615 far_side(position.x, half_size.x),
616 far_side(position.y, half_size.y),
617 ),
618 RadialGradientShape::Circle(radius) => Vec2::splat(
619 radius
620 .resolve(scale_factor, physical_size.x, physical_target_size)
621 .unwrap_or(0.),
622 ),
623 RadialGradientShape::Ellipse(x, y) => Vec2::new(
624 x.resolve(scale_factor, physical_size.x, physical_target_size)
625 .unwrap_or(0.),
626 y.resolve(scale_factor, physical_size.y, physical_target_size)
627 .unwrap_or(0.),
628 ),
629 }
630 }
631}
632
633#[derive(#[automatically_derived]
impl ::core::default::Default for InterpolationColorSpace {
#[inline]
fn default() -> InterpolationColorSpace { Self::Oklaba }
}Default, #[automatically_derived]
impl ::core::marker::Copy for InterpolationColorSpace { }Copy, #[automatically_derived]
impl ::core::clone::Clone for InterpolationColorSpace {
#[inline]
fn clone(&self) -> InterpolationColorSpace { *self }
}Clone, #[automatically_derived]
impl ::core::hash::Hash for InterpolationColorSpace {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
let __self_discr = ::core::intrinsics::discriminant_value(self);
::core::hash::Hash::hash(&__self_discr, state)
}
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for InterpolationColorSpace {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
InterpolationColorSpace::Oklaba => "Oklaba",
InterpolationColorSpace::Oklcha => "Oklcha",
InterpolationColorSpace::OklchaLong => "OklchaLong",
InterpolationColorSpace::Srgba => "Srgba",
InterpolationColorSpace::LinearRgba => "LinearRgba",
InterpolationColorSpace::Hsla => "Hsla",
InterpolationColorSpace::HslaLong => "HslaLong",
InterpolationColorSpace::Hsva => "Hsva",
InterpolationColorSpace::HsvaLong => "HsvaLong",
})
}
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for InterpolationColorSpace {
#[inline]
fn eq(&self, other: &InterpolationColorSpace) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for InterpolationColorSpace {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}Eq, const _: () =
{
impl bevy_reflect::GetTypeRegistration for InterpolationColorSpace
where {
fn get_type_registration() -> bevy_reflect::TypeRegistration {
let mut registration =
bevy_reflect::TypeRegistration::of::<Self>();
registration.insert::<bevy_reflect::ReflectFromPtr>(bevy_reflect::FromType::<Self>::from_type());
registration.insert::<bevy_reflect::ReflectFromReflect>(bevy_reflect::FromType::<Self>::from_type());
registration.register_type_data::<ReflectSerialize, Self>();
registration.register_type_data::<ReflectDeserialize, Self>();
registration
}
#[inline(never)]
fn register_type_dependencies(registry:
&mut bevy_reflect::TypeRegistry) {}
}
impl bevy_reflect::Typed for InterpolationColorSpace where {
#[inline]
fn type_info() -> &'static bevy_reflect::TypeInfo {
static CELL: bevy_reflect::utility::NonGenericTypeInfoCell =
bevy_reflect::utility::NonGenericTypeInfoCell::new();
CELL.get_or_set(||
{
bevy_reflect::TypeInfo::Enum(bevy_reflect::enums::EnumInfo::new::<Self>(&[bevy_reflect::enums::VariantInfo::Unit(bevy_reflect::enums::UnitVariantInfo::new("Oklaba")),
bevy_reflect::enums::VariantInfo::Unit(bevy_reflect::enums::UnitVariantInfo::new("Oklcha")),
bevy_reflect::enums::VariantInfo::Unit(bevy_reflect::enums::UnitVariantInfo::new("OklchaLong")),
bevy_reflect::enums::VariantInfo::Unit(bevy_reflect::enums::UnitVariantInfo::new("Srgba")),
bevy_reflect::enums::VariantInfo::Unit(bevy_reflect::enums::UnitVariantInfo::new("LinearRgba")),
bevy_reflect::enums::VariantInfo::Unit(bevy_reflect::enums::UnitVariantInfo::new("Hsla")),
bevy_reflect::enums::VariantInfo::Unit(bevy_reflect::enums::UnitVariantInfo::new("HslaLong")),
bevy_reflect::enums::VariantInfo::Unit(bevy_reflect::enums::UnitVariantInfo::new("Hsva")),
bevy_reflect::enums::VariantInfo::Unit(bevy_reflect::enums::UnitVariantInfo::new("HsvaLong"))]))
})
}
}
#[allow(deprecated, reason =
"derives on a deprecated type shouldn't be considered a usage")]
impl bevy_reflect::TypePath for InterpolationColorSpace where {
fn type_path() -> &'static str {
"bevy_ui::gradients::InterpolationColorSpace"
}
fn short_type_path() -> &'static str { "InterpolationColorSpace" }
fn type_ident() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("InterpolationColorSpace")
}
fn crate_name() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients".split(':').next().unwrap())
}
fn module_path() -> ::core::option::Option<&'static str> {
::core::option::Option::Some("bevy_ui::gradients")
}
}
impl bevy_reflect::Reflect for InterpolationColorSpace where {
#[inline]
fn into_any(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn ::core::any::Any> {
self
}
#[inline]
fn as_any(&self) -> &dyn ::core::any::Any { self }
#[inline]
fn as_any_mut(&mut self) -> &mut dyn ::core::any::Any { self }
#[inline]
fn into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect> {
self
}
#[inline]
fn as_reflect(&self) -> &dyn bevy_reflect::Reflect { self }
#[inline]
fn as_reflect_mut(&mut self) -> &mut dyn bevy_reflect::Reflect {
self
}
#[inline]
fn set(&mut self,
value:
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>)
->
::core::result::Result<(),
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>> {
*self = <dyn bevy_reflect::Reflect>::take(value)?;
::core::result::Result::Ok(())
}
}
#[allow(non_upper_case_globals)]
const _: () =
{
static __INVENTORY: ::inventory::Node =
::inventory::Node {
value: &{
bevy_reflect::__macro_exports::auto_register::AutomaticReflectRegistrations(<InterpolationColorSpace
as
bevy_reflect::__macro_exports::auto_register::RegisterForReflection>::__register)
},
next: ::inventory::__private::UnsafeCell::new(::inventory::__private::Option::None),
};
#[link_section = ".text.startup"]
unsafe extern "C" fn __ctor() {
unsafe {
::inventory::ErasedNode::submit(__INVENTORY.value,
&__INVENTORY)
}
}
#[used]
#[link_section = ".init_array"]
static __CTOR: unsafe extern "C" fn() = __ctor;
};
impl bevy_reflect::enums::Enum for InterpolationColorSpace where {
fn field(&self, __name_param: &str)
-> ::core::option::Option<&dyn bevy_reflect::PartialReflect> {
match self { _ => ::core::option::Option::None, }
}
fn field_at(&self, __index_param: usize)
-> ::core::option::Option<&dyn bevy_reflect::PartialReflect> {
match self { _ => ::core::option::Option::None, }
}
fn field_mut(&mut self, __name_param: &str)
->
::core::option::Option<&mut dyn bevy_reflect::PartialReflect> {
match self { _ => ::core::option::Option::None, }
}
fn field_at_mut(&mut self, __index_param: usize)
->
::core::option::Option<&mut dyn bevy_reflect::PartialReflect> {
match self { _ => ::core::option::Option::None, }
}
fn index_of(&self, __name_param: &str)
-> ::core::option::Option<usize> {
match self { _ => ::core::option::Option::None, }
}
fn name_at(&self, __index_param: usize)
-> ::core::option::Option<&str> {
match self { _ => ::core::option::Option::None, }
}
fn iter_fields(&self) -> bevy_reflect::enums::VariantFieldIter {
bevy_reflect::enums::VariantFieldIter::new(self)
}
#[inline]
fn field_len(&self) -> usize {
match self {
InterpolationColorSpace::Oklaba { .. } => 0usize,
InterpolationColorSpace::Oklcha { .. } => 0usize,
InterpolationColorSpace::OklchaLong { .. } => 0usize,
InterpolationColorSpace::Srgba { .. } => 0usize,
InterpolationColorSpace::LinearRgba { .. } => 0usize,
InterpolationColorSpace::Hsla { .. } => 0usize,
InterpolationColorSpace::HslaLong { .. } => 0usize,
InterpolationColorSpace::Hsva { .. } => 0usize,
InterpolationColorSpace::HsvaLong { .. } => 0usize,
_ => 0,
}
}
#[inline]
fn variant_name(&self) -> &str {
match self {
InterpolationColorSpace::Oklaba { .. } => "Oklaba",
InterpolationColorSpace::Oklcha { .. } => "Oklcha",
InterpolationColorSpace::OklchaLong { .. } => "OklchaLong",
InterpolationColorSpace::Srgba { .. } => "Srgba",
InterpolationColorSpace::LinearRgba { .. } => "LinearRgba",
InterpolationColorSpace::Hsla { .. } => "Hsla",
InterpolationColorSpace::HslaLong { .. } => "HslaLong",
InterpolationColorSpace::Hsva { .. } => "Hsva",
InterpolationColorSpace::HsvaLong { .. } => "HsvaLong",
_ =>
::core::panicking::panic("internal error: entered unreachable code"),
}
}
#[inline]
fn variant_index(&self) -> usize {
match self {
InterpolationColorSpace::Oklaba { .. } => 0usize,
InterpolationColorSpace::Oklcha { .. } => 1usize,
InterpolationColorSpace::OklchaLong { .. } => 2usize,
InterpolationColorSpace::Srgba { .. } => 3usize,
InterpolationColorSpace::LinearRgba { .. } => 4usize,
InterpolationColorSpace::Hsla { .. } => 5usize,
InterpolationColorSpace::HslaLong { .. } => 6usize,
InterpolationColorSpace::Hsva { .. } => 7usize,
InterpolationColorSpace::HsvaLong { .. } => 8usize,
_ =>
::core::panicking::panic("internal error: entered unreachable code"),
}
}
#[inline]
fn variant_type(&self) -> bevy_reflect::enums::VariantType {
match self {
InterpolationColorSpace::Oklaba { .. } =>
bevy_reflect::enums::VariantType::Unit,
InterpolationColorSpace::Oklcha { .. } =>
bevy_reflect::enums::VariantType::Unit,
InterpolationColorSpace::OklchaLong { .. } =>
bevy_reflect::enums::VariantType::Unit,
InterpolationColorSpace::Srgba { .. } =>
bevy_reflect::enums::VariantType::Unit,
InterpolationColorSpace::LinearRgba { .. } =>
bevy_reflect::enums::VariantType::Unit,
InterpolationColorSpace::Hsla { .. } =>
bevy_reflect::enums::VariantType::Unit,
InterpolationColorSpace::HslaLong { .. } =>
bevy_reflect::enums::VariantType::Unit,
InterpolationColorSpace::Hsva { .. } =>
bevy_reflect::enums::VariantType::Unit,
InterpolationColorSpace::HsvaLong { .. } =>
bevy_reflect::enums::VariantType::Unit,
_ =>
::core::panicking::panic("internal error: entered unreachable code"),
}
}
fn to_dynamic_enum(&self) -> bevy_reflect::enums::DynamicEnum {
bevy_reflect::enums::DynamicEnum::from_ref::<Self>(self)
}
}
impl bevy_reflect::PartialReflect for InterpolationColorSpace where {
#[inline]
fn get_represented_type_info(&self)
-> ::core::option::Option<&'static bevy_reflect::TypeInfo> {
::core::option::Option::Some(<Self as
bevy_reflect::Typed>::type_info())
}
#[inline]
fn try_apply(&mut self,
__value_param: &dyn bevy_reflect::PartialReflect)
-> ::core::result::Result<(), bevy_reflect::ApplyError> {
if let bevy_reflect::ReflectRef::Enum(__value_param) =
bevy_reflect::PartialReflect::reflect_ref(__value_param) {
if bevy_reflect::enums::Enum::variant_name(self) ==
bevy_reflect::enums::Enum::variant_name(__value_param) {
match bevy_reflect::enums::Enum::variant_type(__value_param)
{
bevy_reflect::enums::VariantType::Struct => {
for field in
bevy_reflect::enums::Enum::iter_fields(__value_param) {
let name = field.name().unwrap();
if let ::core::option::Option::Some(v) =
bevy_reflect::enums::Enum::field_mut(self, name) {
bevy_reflect::PartialReflect::try_apply(v, field.value())?;
}
}
}
bevy_reflect::enums::VariantType::Tuple => {
for (index, field) in
::core::iter::Iterator::enumerate(bevy_reflect::enums::Enum::iter_fields(__value_param))
{
if let ::core::option::Option::Some(v) =
bevy_reflect::enums::Enum::field_at_mut(self, index) {
bevy_reflect::PartialReflect::try_apply(v, field.value())?;
}
}
}
_ => {}
}
} else {
match bevy_reflect::enums::Enum::variant_name(__value_param)
{
"Oklaba" => { *self = InterpolationColorSpace::Oklaba {} }
"Oklcha" => { *self = InterpolationColorSpace::Oklcha {} }
"OklchaLong" => {
*self = InterpolationColorSpace::OklchaLong {}
}
"Srgba" => { *self = InterpolationColorSpace::Srgba {} }
"LinearRgba" => {
*self = InterpolationColorSpace::LinearRgba {}
}
"Hsla" => { *self = InterpolationColorSpace::Hsla {} }
"HslaLong" => {
*self = InterpolationColorSpace::HslaLong {}
}
"Hsva" => { *self = InterpolationColorSpace::Hsva {} }
"HsvaLong" => {
*self = InterpolationColorSpace::HsvaLong {}
}
name => {
return ::core::result::Result::Err(bevy_reflect::ApplyError::UnknownVariant {
enum_name: ::core::convert::Into::into(bevy_reflect::DynamicTypePath::reflect_type_path(self)),
variant_name: ::core::convert::Into::into(name),
});
}
}
}
} else {
return ::core::result::Result::Err(bevy_reflect::ApplyError::MismatchedKinds {
from_kind: bevy_reflect::PartialReflect::reflect_kind(__value_param),
to_kind: bevy_reflect::ReflectKind::Enum,
});
}
::core::result::Result::Ok(())
}
fn reflect_kind(&self) -> bevy_reflect::ReflectKind {
bevy_reflect::ReflectKind::Enum
}
fn reflect_ref(&self) -> bevy_reflect::ReflectRef {
bevy_reflect::ReflectRef::Enum(self)
}
fn reflect_mut(&mut self) -> bevy_reflect::ReflectMut {
bevy_reflect::ReflectMut::Enum(self)
}
fn reflect_owned(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
-> bevy_reflect::ReflectOwned {
bevy_reflect::ReflectOwned::Enum(self)
}
#[inline]
fn try_into_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect>> {
::core::result::Result::Ok(self)
}
#[inline]
fn try_as_reflect(&self)
-> ::core::option::Option<&dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn try_as_reflect_mut(&mut self)
-> ::core::option::Option<&mut dyn bevy_reflect::Reflect> {
::core::option::Option::Some(self)
}
#[inline]
fn into_partial_reflect(self:
bevy_reflect::__macro_exports::alloc_utils::Box<Self>)
->
bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::PartialReflect> {
self
}
#[inline]
fn as_partial_reflect(&self)
-> &dyn bevy_reflect::PartialReflect {
self
}
#[inline]
fn as_partial_reflect_mut(&mut self)
-> &mut dyn bevy_reflect::PartialReflect {
self
}
fn reflect_hash(&self) -> ::core::option::Option<u64> {
(bevy_reflect::enums::enum_hash)(self)
}
fn reflect_partial_eq(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<bool> {
(bevy_reflect::enums::enum_partial_eq)(self, value)
}
fn reflect_partial_cmp(&self,
value: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<::core::cmp::Ordering> {
(bevy_reflect::enums::enum_partial_cmp)(self, value)
}
#[inline]
#[allow(unreachable_code, reason =
"Ignored fields without a `clone` attribute will early-return with an error")]
fn reflect_clone(&self)
->
::core::result::Result<bevy_reflect::__macro_exports::alloc_utils::Box<dyn bevy_reflect::Reflect>,
bevy_reflect::ReflectCloneError> {
let this = self;
::core::result::Result::Ok(bevy_reflect::__macro_exports::alloc_utils::Box::new(match this
{
InterpolationColorSpace::Oklaba {} =>
InterpolationColorSpace::Oklaba {},
InterpolationColorSpace::Oklcha {} =>
InterpolationColorSpace::Oklcha {},
InterpolationColorSpace::OklchaLong {} =>
InterpolationColorSpace::OklchaLong {},
InterpolationColorSpace::Srgba {} =>
InterpolationColorSpace::Srgba {},
InterpolationColorSpace::LinearRgba {} =>
InterpolationColorSpace::LinearRgba {},
InterpolationColorSpace::Hsla {} =>
InterpolationColorSpace::Hsla {},
InterpolationColorSpace::HslaLong {} =>
InterpolationColorSpace::HslaLong {},
InterpolationColorSpace::Hsva {} =>
InterpolationColorSpace::Hsva {},
InterpolationColorSpace::HsvaLong {} =>
InterpolationColorSpace::HsvaLong {},
}))
}
}
impl bevy_reflect::FromReflect for InterpolationColorSpace where {
fn from_reflect(__param0: &dyn bevy_reflect::PartialReflect)
-> ::core::option::Option<Self> {
if let bevy_reflect::ReflectRef::Enum(__param0) =
bevy_reflect::PartialReflect::reflect_ref(__param0) {
match bevy_reflect::enums::Enum::variant_name(__param0) {
"Oklaba" =>
::core::option::Option::Some(InterpolationColorSpace::Oklaba {}),
"Oklcha" =>
::core::option::Option::Some(InterpolationColorSpace::Oklcha {}),
"OklchaLong" =>
::core::option::Option::Some(InterpolationColorSpace::OklchaLong {}),
"Srgba" =>
::core::option::Option::Some(InterpolationColorSpace::Srgba {}),
"LinearRgba" =>
::core::option::Option::Some(InterpolationColorSpace::LinearRgba {}),
"Hsla" =>
::core::option::Option::Some(InterpolationColorSpace::Hsla {}),
"HslaLong" =>
::core::option::Option::Some(InterpolationColorSpace::HslaLong {}),
"Hsva" =>
::core::option::Option::Some(InterpolationColorSpace::Hsva {}),
"HsvaLong" =>
::core::option::Option::Some(InterpolationColorSpace::HsvaLong {}),
name => ::core::option::Option::None,
}
} else { ::core::option::Option::None }
}
}
};Reflect)]
635#[cfg_attr(
636 feature = "serialize",
637 derive(#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl _serde::Serialize for InterpolationColorSpace {
fn serialize<__S>(&self, __serializer: __S)
-> _serde::__private228::Result<__S::Ok, __S::Error> where
__S: _serde::Serializer {
match *self {
InterpolationColorSpace::Oklaba =>
_serde::Serializer::serialize_unit_variant(__serializer,
"InterpolationColorSpace", 0u32, "Oklaba"),
InterpolationColorSpace::Oklcha =>
_serde::Serializer::serialize_unit_variant(__serializer,
"InterpolationColorSpace", 1u32, "Oklcha"),
InterpolationColorSpace::OklchaLong =>
_serde::Serializer::serialize_unit_variant(__serializer,
"InterpolationColorSpace", 2u32, "OklchaLong"),
InterpolationColorSpace::Srgba =>
_serde::Serializer::serialize_unit_variant(__serializer,
"InterpolationColorSpace", 3u32, "Srgba"),
InterpolationColorSpace::LinearRgba =>
_serde::Serializer::serialize_unit_variant(__serializer,
"InterpolationColorSpace", 4u32, "LinearRgba"),
InterpolationColorSpace::Hsla =>
_serde::Serializer::serialize_unit_variant(__serializer,
"InterpolationColorSpace", 5u32, "Hsla"),
InterpolationColorSpace::HslaLong =>
_serde::Serializer::serialize_unit_variant(__serializer,
"InterpolationColorSpace", 6u32, "HslaLong"),
InterpolationColorSpace::Hsva =>
_serde::Serializer::serialize_unit_variant(__serializer,
"InterpolationColorSpace", 7u32, "Hsva"),
InterpolationColorSpace::HsvaLong =>
_serde::Serializer::serialize_unit_variant(__serializer,
"InterpolationColorSpace", 8u32, "HsvaLong"),
}
}
}
};serde::Serialize, #[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications,
clippy :: absolute_paths,)]
const _: () =
{
#[allow(unused_extern_crates, clippy :: useless_attribute)]
extern crate serde as _serde;
;
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for InterpolationColorSpace {
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
#[allow(non_camel_case_types)]
#[doc(hidden)]
enum __Field {
__field0,
__field1,
__field2,
__field3,
__field4,
__field5,
__field6,
__field7,
__field8,
}
#[doc(hidden)]
struct __FieldVisitor;
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
type Value = __Field;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"variant identifier")
}
fn visit_u64<__E>(self, __value: u64)
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
0u64 => _serde::__private228::Ok(__Field::__field0),
1u64 => _serde::__private228::Ok(__Field::__field1),
2u64 => _serde::__private228::Ok(__Field::__field2),
3u64 => _serde::__private228::Ok(__Field::__field3),
4u64 => _serde::__private228::Ok(__Field::__field4),
5u64 => _serde::__private228::Ok(__Field::__field5),
6u64 => _serde::__private228::Ok(__Field::__field6),
7u64 => _serde::__private228::Ok(__Field::__field7),
8u64 => _serde::__private228::Ok(__Field::__field8),
_ =>
_serde::__private228::Err(_serde::de::Error::invalid_value(_serde::de::Unexpected::Unsigned(__value),
&"variant index 0 <= i < 9")),
}
}
fn visit_str<__E>(self, __value: &str)
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
"Oklaba" => _serde::__private228::Ok(__Field::__field0),
"Oklcha" => _serde::__private228::Ok(__Field::__field1),
"OklchaLong" => _serde::__private228::Ok(__Field::__field2),
"Srgba" => _serde::__private228::Ok(__Field::__field3),
"LinearRgba" => _serde::__private228::Ok(__Field::__field4),
"Hsla" => _serde::__private228::Ok(__Field::__field5),
"HslaLong" => _serde::__private228::Ok(__Field::__field6),
"Hsva" => _serde::__private228::Ok(__Field::__field7),
"HsvaLong" => _serde::__private228::Ok(__Field::__field8),
_ => {
_serde::__private228::Err(_serde::de::Error::unknown_variant(__value,
VARIANTS))
}
}
}
fn visit_bytes<__E>(self, __value: &[u8])
-> _serde::__private228::Result<Self::Value, __E> where
__E: _serde::de::Error {
match __value {
b"Oklaba" => _serde::__private228::Ok(__Field::__field0),
b"Oklcha" => _serde::__private228::Ok(__Field::__field1),
b"OklchaLong" =>
_serde::__private228::Ok(__Field::__field2),
b"Srgba" => _serde::__private228::Ok(__Field::__field3),
b"LinearRgba" =>
_serde::__private228::Ok(__Field::__field4),
b"Hsla" => _serde::__private228::Ok(__Field::__field5),
b"HslaLong" => _serde::__private228::Ok(__Field::__field6),
b"Hsva" => _serde::__private228::Ok(__Field::__field7),
b"HsvaLong" => _serde::__private228::Ok(__Field::__field8),
_ => {
let __value =
&_serde::__private228::from_utf8_lossy(__value);
_serde::__private228::Err(_serde::de::Error::unknown_variant(__value,
VARIANTS))
}
}
}
}
#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]
fn deserialize<__D>(__deserializer: __D)
-> _serde::__private228::Result<Self, __D::Error> where
__D: _serde::Deserializer<'de> {
_serde::Deserializer::deserialize_identifier(__deserializer,
__FieldVisitor)
}
}
#[doc(hidden)]
struct __Visitor<'de> {
marker: _serde::__private228::PhantomData<InterpolationColorSpace>,
lifetime: _serde::__private228::PhantomData<&'de ()>,
}
#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __Visitor<'de> {
type Value = InterpolationColorSpace;
fn expecting(&self,
__formatter: &mut _serde::__private228::Formatter)
-> _serde::__private228::fmt::Result {
_serde::__private228::Formatter::write_str(__formatter,
"enum InterpolationColorSpace")
}
fn visit_enum<__A>(self, __data: __A)
-> _serde::__private228::Result<Self::Value, __A::Error>
where __A: _serde::de::EnumAccess<'de> {
match _serde::de::EnumAccess::variant(__data)? {
(__Field::__field0, __variant) => {
_serde::de::VariantAccess::unit_variant(__variant)?;
_serde::__private228::Ok(InterpolationColorSpace::Oklaba)
}
(__Field::__field1, __variant) => {
_serde::de::VariantAccess::unit_variant(__variant)?;
_serde::__private228::Ok(InterpolationColorSpace::Oklcha)
}
(__Field::__field2, __variant) => {
_serde::de::VariantAccess::unit_variant(__variant)?;
_serde::__private228::Ok(InterpolationColorSpace::OklchaLong)
}
(__Field::__field3, __variant) => {
_serde::de::VariantAccess::unit_variant(__variant)?;
_serde::__private228::Ok(InterpolationColorSpace::Srgba)
}
(__Field::__field4, __variant) => {
_serde::de::VariantAccess::unit_variant(__variant)?;
_serde::__private228::Ok(InterpolationColorSpace::LinearRgba)
}
(__Field::__field5, __variant) => {
_serde::de::VariantAccess::unit_variant(__variant)?;
_serde::__private228::Ok(InterpolationColorSpace::Hsla)
}
(__Field::__field6, __variant) => {
_serde::de::VariantAccess::unit_variant(__variant)?;
_serde::__private228::Ok(InterpolationColorSpace::HslaLong)
}
(__Field::__field7, __variant) => {
_serde::de::VariantAccess::unit_variant(__variant)?;
_serde::__private228::Ok(InterpolationColorSpace::Hsva)
}
(__Field::__field8, __variant) => {
_serde::de::VariantAccess::unit_variant(__variant)?;
_serde::__private228::Ok(InterpolationColorSpace::HsvaLong)
}
}
}
}
#[doc(hidden)]
const VARIANTS: &'static [&'static str] =
&["Oklaba", "Oklcha", "OklchaLong", "Srgba", "LinearRgba",
"Hsla", "HslaLong", "Hsva", "HsvaLong"];
_serde::Deserializer::deserialize_enum(__deserializer,
"InterpolationColorSpace", VARIANTS,
__Visitor {
marker: _serde::__private228::PhantomData::<InterpolationColorSpace>,
lifetime: _serde::__private228::PhantomData,
})
}
}
};serde::Deserialize),
638 reflect(Serialize, Deserialize)
639)]
640pub enum InterpolationColorSpace {
641 #[default]
643 Oklaba,
644 Oklcha,
646 OklchaLong,
648 Srgba,
650 LinearRgba,
652 Hsla,
654 HslaLong,
656 Hsva,
658 HsvaLong,
660}
661
662pub trait InColorSpace: Sized {
664 fn in_color_space(self, color_space: InterpolationColorSpace) -> Self;
666
667 fn in_oklaba(self) -> Self {
669 self.in_color_space(InterpolationColorSpace::Oklaba)
670 }
671
672 fn in_oklch(self) -> Self {
674 self.in_color_space(InterpolationColorSpace::Oklcha)
675 }
676
677 fn in_oklch_long(self) -> Self {
679 self.in_color_space(InterpolationColorSpace::OklchaLong)
680 }
681
682 fn in_srgb(self) -> Self {
684 self.in_color_space(InterpolationColorSpace::Srgba)
685 }
686
687 fn in_linear_rgb(self) -> Self {
689 self.in_color_space(InterpolationColorSpace::LinearRgba)
690 }
691}
692
693impl InColorSpace for LinearGradient {
694 fn in_color_space(mut self, color_space: InterpolationColorSpace) -> Self {
696 self.color_space = color_space;
697 self
698 }
699}
700
701impl InColorSpace for RadialGradient {
702 fn in_color_space(mut self, color_space: InterpolationColorSpace) -> Self {
704 self.color_space = color_space;
705 self
706 }
707}
708
709impl InColorSpace for ConicGradient {
710 fn in_color_space(mut self, color_space: InterpolationColorSpace) -> Self {
712 self.color_space = color_space;
713 self
714 }
715}