pub struct DrawOrder(/* private fields */);Expand description
A struct representing the draw order of an entity Higher draw orders will be drawn on top of lower draw orders
Implementations§
Methods from Deref<Target = f32>§
pub const RADIX: u32 = 2
pub const BITS: u32 = 32
pub const MANTISSA_DIGITS: u32 = 24
pub const DIGITS: u32 = 6
pub const EPSILON: f32 = 1.19209290e-07_f32
pub const MIN: f32 = -3.40282347e+38_f32
pub const MIN_POSITIVE: f32 = 1.17549435e-38_f32
pub const MAX: f32 = 3.40282347e+38_f32
pub const MIN_EXP: i32 = -125
pub const MAX_EXP: i32 = 128
pub const MIN_10_EXP: i32 = -37
pub const MAX_10_EXP: i32 = 38
pub const NAN: f32
pub const INFINITY: f32
pub const NEG_INFINITY: f32
pub const MAX_EXACT_INTEGER: i32
pub const MIN_EXACT_INTEGER: i32
pub const SIGN_MASK: u32 = 0x8000_0000
pub const EXPONENT_MASK: u32 = 0x7f80_0000
pub const MANTISSA_MASK: u32 = 0x007f_ffff
1.62.0 · Sourcepub fn total_cmp(&self, other: &f32) -> Ordering
pub fn total_cmp(&self, other: &f32) -> Ordering
Returns the ordering between self and other.
Unlike the standard partial comparison between floating point numbers,
this comparison always produces an ordering in accordance to
the totalOrder predicate as defined in the IEEE 754 (2008 revision)
floating point standard. The values are ordered in the following sequence:
- negative quiet NaN
- negative signaling NaN
- negative infinity
- negative numbers
- negative subnormal numbers
- negative zero
- positive zero
- positive subnormal numbers
- positive numbers
- positive infinity
- positive signaling NaN
- positive quiet NaN.
The ordering established by this function does not always agree with the
PartialOrd and PartialEq implementations of f32. For example,
they consider negative and positive zero equal, while total_cmp
doesn’t.
The interpretation of the signaling NaN bit follows the definition in the IEEE 754 standard, which may not match the interpretation by some of the older, non-conformant (e.g. MIPS) hardware implementations.
§Example
struct GoodBoy {
name: String,
weight: f32,
}
let mut bois = vec![
GoodBoy { name: "Pucci".to_owned(), weight: 0.1 },
GoodBoy { name: "Woofer".to_owned(), weight: 99.0 },
GoodBoy { name: "Yapper".to_owned(), weight: 10.0 },
GoodBoy { name: "Chonk".to_owned(), weight: f32::INFINITY },
GoodBoy { name: "Abs. Unit".to_owned(), weight: f32::NAN },
GoodBoy { name: "Floaty".to_owned(), weight: -5.0 },
];
bois.sort_by(|a, b| a.weight.total_cmp(&b.weight));
// `f32::NAN` could be positive or negative, which will affect the sort order.
if f32::NAN.is_sign_negative() {
assert!(bois.into_iter().map(|b| b.weight)
.zip([f32::NAN, -5.0, 0.1, 10.0, 99.0, f32::INFINITY].iter())
.all(|(a, b)| a.to_bits() == b.to_bits()))
} else {
assert!(bois.into_iter().map(|b| b.weight)
.zip([-5.0, 0.1, 10.0, 99.0, f32::INFINITY, f32::NAN].iter())
.all(|(a, b)| a.to_bits() == b.to_bits()))
}Trait Implementations§
Source§impl AddAssign for DrawOrder
impl AddAssign for DrawOrder
Source§fn add_assign(&mut self, rhs: DrawOrder)
fn add_assign(&mut self, rhs: DrawOrder)
+= operation. Read moreSource§impl AddAssign<&DrawOrder> for DrawOrder
impl AddAssign<&DrawOrder> for DrawOrder
Source§fn add_assign(&mut self, rhs: &DrawOrder)
fn add_assign(&mut self, rhs: &DrawOrder)
+= operation. Read moreSource§impl AddAssign<&DrawOrder> for f32
impl AddAssign<&DrawOrder> for f32
Source§fn add_assign(&mut self, rhs: &DrawOrder)
fn add_assign(&mut self, rhs: &DrawOrder)
+= operation. Read moreSource§impl AddAssign<DrawOrder> for f32
impl AddAssign<DrawOrder> for f32
Source§fn add_assign(&mut self, rhs: DrawOrder)
fn add_assign(&mut self, rhs: DrawOrder)
+= operation. Read moreSource§impl AddAssign<f32> for DrawOrder
impl AddAssign<f32> for DrawOrder
Source§fn add_assign(&mut self, rhs: f32)
fn add_assign(&mut self, rhs: f32)
+= operation. Read moreSource§impl Component for DrawOrder
impl Component for DrawOrder
Source§const STORAGE_TYPE: StorageType = bevy::ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy::ecs::component::StorageType::Table
Source§fn register_component_hooks(_hooks: &mut ComponentHooks)
fn register_component_hooks(_hooks: &mut ComponentHooks)
ComponentHooks.impl Copy for DrawOrder
Source§impl<'de> Deserialize<'de> for DrawOrder
impl<'de> Deserialize<'de> for DrawOrder
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DrawOrder, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DrawOrder, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl DivAssign for DrawOrder
impl DivAssign for DrawOrder
Source§fn div_assign(&mut self, rhs: DrawOrder)
fn div_assign(&mut self, rhs: DrawOrder)
/= operation. Read moreSource§impl DivAssign<&DrawOrder> for DrawOrder
impl DivAssign<&DrawOrder> for DrawOrder
Source§fn div_assign(&mut self, rhs: &DrawOrder)
fn div_assign(&mut self, rhs: &DrawOrder)
/= operation. Read moreSource§impl DivAssign<&DrawOrder> for f32
impl DivAssign<&DrawOrder> for f32
Source§fn div_assign(&mut self, rhs: &DrawOrder)
fn div_assign(&mut self, rhs: &DrawOrder)
/= operation. Read moreSource§impl DivAssign<DrawOrder> for f32
impl DivAssign<DrawOrder> for f32
Source§fn div_assign(&mut self, rhs: DrawOrder)
fn div_assign(&mut self, rhs: DrawOrder)
/= operation. Read moreSource§impl DivAssign<f32> for DrawOrder
impl DivAssign<f32> for DrawOrder
Source§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
/= operation. Read moreSource§impl FromReflect for DrawOrder
impl FromReflect for DrawOrder
Source§fn from_reflect(reflect: &(dyn Reflect + 'static)) -> Option<DrawOrder>
fn from_reflect(reflect: &(dyn Reflect + 'static)) -> Option<DrawOrder>
Self from a reflected value.Source§fn take_from_reflect(
reflect: Box<dyn Reflect>,
) -> Result<Self, Box<dyn Reflect>>
fn take_from_reflect( reflect: Box<dyn Reflect>, ) -> Result<Self, Box<dyn Reflect>>
Self using,
constructing the value using from_reflect if that fails. Read moreSource§impl GetTypeRegistration for DrawOrder
impl GetTypeRegistration for DrawOrder
Source§fn get_type_registration() -> TypeRegistration
fn get_type_registration() -> TypeRegistration
TypeRegistration for this type.Source§fn register_type_dependencies(registry: &mut TypeRegistry)
fn register_type_dependencies(registry: &mut TypeRegistry)
Source§impl MulAssign for DrawOrder
impl MulAssign for DrawOrder
Source§fn mul_assign(&mut self, rhs: DrawOrder)
fn mul_assign(&mut self, rhs: DrawOrder)
*= operation. Read moreSource§impl MulAssign<&DrawOrder> for DrawOrder
impl MulAssign<&DrawOrder> for DrawOrder
Source§fn mul_assign(&mut self, rhs: &DrawOrder)
fn mul_assign(&mut self, rhs: &DrawOrder)
*= operation. Read moreSource§impl MulAssign<&DrawOrder> for f32
impl MulAssign<&DrawOrder> for f32
Source§fn mul_assign(&mut self, rhs: &DrawOrder)
fn mul_assign(&mut self, rhs: &DrawOrder)
*= operation. Read moreSource§impl MulAssign<DrawOrder> for f32
impl MulAssign<DrawOrder> for f32
Source§fn mul_assign(&mut self, rhs: DrawOrder)
fn mul_assign(&mut self, rhs: DrawOrder)
*= operation. Read moreSource§impl MulAssign<f32> for DrawOrder
impl MulAssign<f32> for DrawOrder
Source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
*= operation. Read moreSource§impl Reflect for DrawOrder
impl Reflect for DrawOrder
Source§fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut dyn Any.Source§fn into_reflect(self: Box<DrawOrder>) -> Box<dyn Reflect>
fn into_reflect(self: Box<DrawOrder>) -> Box<dyn Reflect>
Source§fn as_reflect(&self) -> &(dyn Reflect + 'static)
fn as_reflect(&self) -> &(dyn Reflect + 'static)
Source§fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
Source§fn clone_value(&self) -> Box<dyn Reflect>
fn clone_value(&self) -> Box<dyn Reflect>
Reflect trait object. Read moreSource§fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>>
fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>>
Source§fn reflect_kind(&self) -> ReflectKind
fn reflect_kind(&self) -> ReflectKind
Source§fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
Source§fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
Source§fn reflect_owned(self: Box<DrawOrder>) -> ReflectOwned
fn reflect_owned(self: Box<DrawOrder>) -> ReflectOwned
Source§fn reflect_partial_eq(&self, value: &(dyn Reflect + 'static)) -> Option<bool>
fn reflect_partial_eq(&self, value: &(dyn Reflect + 'static)) -> Option<bool>
Source§fn apply(&mut self, value: &(dyn Reflect + 'static))
fn apply(&mut self, value: &(dyn Reflect + 'static))
Source§fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
Source§fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Source§fn serializable(&self) -> Option<Serializable<'_>>
fn serializable(&self) -> Option<Serializable<'_>>
Source§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
Source§impl RemAssign for DrawOrder
impl RemAssign for DrawOrder
Source§fn rem_assign(&mut self, rhs: DrawOrder)
fn rem_assign(&mut self, rhs: DrawOrder)
%= operation. Read moreSource§impl RemAssign<&DrawOrder> for DrawOrder
impl RemAssign<&DrawOrder> for DrawOrder
Source§fn rem_assign(&mut self, rhs: &DrawOrder)
fn rem_assign(&mut self, rhs: &DrawOrder)
%= operation. Read moreSource§impl RemAssign<&DrawOrder> for f32
impl RemAssign<&DrawOrder> for f32
Source§fn rem_assign(&mut self, rhs: &DrawOrder)
fn rem_assign(&mut self, rhs: &DrawOrder)
%= operation. Read moreSource§impl RemAssign<DrawOrder> for f32
impl RemAssign<DrawOrder> for f32
Source§fn rem_assign(&mut self, rhs: DrawOrder)
fn rem_assign(&mut self, rhs: DrawOrder)
%= operation. Read moreSource§impl RemAssign<f32> for DrawOrder
impl RemAssign<f32> for DrawOrder
Source§fn rem_assign(&mut self, rhs: f32)
fn rem_assign(&mut self, rhs: f32)
%= operation. Read moreSource§impl Serialize for DrawOrder
impl Serialize for DrawOrder
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for DrawOrder
Source§impl SubAssign for DrawOrder
impl SubAssign for DrawOrder
Source§fn sub_assign(&mut self, rhs: DrawOrder)
fn sub_assign(&mut self, rhs: DrawOrder)
-= operation. Read moreSource§impl SubAssign<&DrawOrder> for DrawOrder
impl SubAssign<&DrawOrder> for DrawOrder
Source§fn sub_assign(&mut self, rhs: &DrawOrder)
fn sub_assign(&mut self, rhs: &DrawOrder)
-= operation. Read moreSource§impl SubAssign<&DrawOrder> for f32
impl SubAssign<&DrawOrder> for f32
Source§fn sub_assign(&mut self, rhs: &DrawOrder)
fn sub_assign(&mut self, rhs: &DrawOrder)
-= operation. Read moreSource§impl SubAssign<DrawOrder> for f32
impl SubAssign<DrawOrder> for f32
Source§fn sub_assign(&mut self, rhs: DrawOrder)
fn sub_assign(&mut self, rhs: DrawOrder)
-= operation. Read moreSource§impl SubAssign<f32> for DrawOrder
impl SubAssign<f32> for DrawOrder
Source§fn sub_assign(&mut self, rhs: f32)
fn sub_assign(&mut self, rhs: f32)
-= operation. Read moreSource§impl TupleStruct for DrawOrder
impl TupleStruct for DrawOrder
Source§fn field(&self, index: usize) -> Option<&(dyn Reflect + 'static)>
fn field(&self, index: usize) -> Option<&(dyn Reflect + 'static)>
index as a
&dyn Reflect.Source§fn field_mut(&mut self, index: usize) -> Option<&mut (dyn Reflect + 'static)>
fn field_mut(&mut self, index: usize) -> Option<&mut (dyn Reflect + 'static)>
index
as a &mut dyn Reflect.Source§fn iter_fields(&self) -> TupleStructFieldIter<'_>
fn iter_fields(&self) -> TupleStructFieldIter<'_>
Source§fn clone_dynamic(&self) -> DynamicTupleStruct
fn clone_dynamic(&self) -> DynamicTupleStruct
DynamicTupleStruct.Source§impl TypePath for DrawOrder
impl TypePath for DrawOrder
Source§fn type_path() -> &'static str
fn type_path() -> &'static str
Source§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
Source§fn type_ident() -> Option<&'static str>
fn type_ident() -> Option<&'static str>
Source§fn crate_name() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
Auto Trait Implementations§
impl Freeze for DrawOrder
impl RefUnwindSafe for DrawOrder
impl Send for DrawOrder
impl Sync for DrawOrder
impl Unpin for DrawOrder
impl UnsafeUnpin for DrawOrder
impl UnwindSafe for DrawOrder
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId), )
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> C
Source§fn get_component_ids(
components: &Components,
ids: &mut impl FnMut(Option<ComponentId>),
)
fn get_component_ids( components: &Components, ids: &mut impl FnMut(Option<ComponentId>), )
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
fn get_components(self, func: &mut impl FnMut(StorageType, OwningPtr<'_>))
Source§impl<T> DynamicTypePath for Twhere
T: TypePath,
impl<T> DynamicTypePath for Twhere
T: TypePath,
Source§fn reflect_type_path(&self) -> &str
fn reflect_type_path(&self) -> &str
TypePath::type_path.Source§fn reflect_short_type_path(&self) -> &str
fn reflect_short_type_path(&self) -> &str
Source§fn reflect_type_ident(&self) -> Option<&str>
fn reflect_type_ident(&self) -> Option<&str>
TypePath::type_ident.Source§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
TypePath::crate_name.Source§fn reflect_module_path(&self) -> Option<&str>
fn reflect_module_path(&self) -> Option<&str>
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self using data from the given World.Source§impl<T> GetPath for T
impl<T> GetPath for T
Source§fn reflect_path<'p>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&(dyn Reflect + 'static), ReflectPathError<'p>>
fn reflect_path<'p>( &self, path: impl ReflectPath<'p>, ) -> Result<&(dyn Reflect + 'static), ReflectPathError<'p>>
path. Read moreSource§fn reflect_path_mut<'p>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut (dyn Reflect + 'static), ReflectPathError<'p>>
fn reflect_path_mut<'p>( &mut self, path: impl ReflectPath<'p>, ) -> Result<&mut (dyn Reflect + 'static), ReflectPathError<'p>>
path. Read moreSource§fn path<'p, T>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
fn path<'p, T>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
path. Read moreSource§fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
path. Read more