Add newlines before impl blocks (#19746)
# Objective Fix https://github.com/bevyengine/bevy/issues/19617 # Solution Add newlines before all impl blocks. I suspect that at least some of these will be objectionable! If there's a desired Bevy style for this then I'll update the PR. If not then we can just close it - it's the work of a single find and replace.
This commit is contained in:
parent
a466084167
commit
7645ce91ed
@ -49,6 +49,7 @@ impl BenchModify for Table {
|
|||||||
black_box(self.0)
|
black_box(self.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BenchModify for Sparse {
|
impl BenchModify for Sparse {
|
||||||
fn bench_modify(&mut self) -> f32 {
|
fn bench_modify(&mut self) -> f32 {
|
||||||
self.0 += 1f32;
|
self.0 += 1f32;
|
||||||
|
@ -88,6 +88,7 @@ impl<C: Component + Clone + PartialEq> core::fmt::Debug for PropagateSet<C> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<C: Component + Clone + PartialEq> Eq for PropagateSet<C> {}
|
impl<C: Component + Clone + PartialEq> Eq for PropagateSet<C> {}
|
||||||
|
|
||||||
impl<C: Component + Clone + PartialEq> core::hash::Hash for PropagateSet<C> {
|
impl<C: Component + Clone + PartialEq> core::hash::Hash for PropagateSet<C> {
|
||||||
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
|
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
|
||||||
self._p.hash(state);
|
self._p.hash(state);
|
||||||
|
@ -20,6 +20,7 @@ pub trait DirectAssetAccessExt {
|
|||||||
settings: impl Fn(&mut S) + Send + Sync + 'static,
|
settings: impl Fn(&mut S) + Send + Sync + 'static,
|
||||||
) -> Handle<A>;
|
) -> Handle<A>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DirectAssetAccessExt for World {
|
impl DirectAssetAccessExt for World {
|
||||||
/// Insert an asset similarly to [`Assets::add`].
|
/// Insert an asset similarly to [`Assets::add`].
|
||||||
///
|
///
|
||||||
|
@ -56,6 +56,7 @@ pub(crate) struct EmbeddedEventHandler {
|
|||||||
dir: Dir,
|
dir: Dir,
|
||||||
last_event: Option<AssetSourceEvent>,
|
last_event: Option<AssetSourceEvent>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FilesystemEventHandler for EmbeddedEventHandler {
|
impl FilesystemEventHandler for EmbeddedEventHandler {
|
||||||
fn begin(&mut self) {
|
fn begin(&mut self) {
|
||||||
self.last_event = None;
|
self.last_event = None;
|
||||||
|
@ -141,16 +141,19 @@ impl EmbeddedAssetRegistry {
|
|||||||
pub trait GetAssetServer {
|
pub trait GetAssetServer {
|
||||||
fn get_asset_server(&self) -> &AssetServer;
|
fn get_asset_server(&self) -> &AssetServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GetAssetServer for App {
|
impl GetAssetServer for App {
|
||||||
fn get_asset_server(&self) -> &AssetServer {
|
fn get_asset_server(&self) -> &AssetServer {
|
||||||
self.world().get_asset_server()
|
self.world().get_asset_server()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GetAssetServer for World {
|
impl GetAssetServer for World {
|
||||||
fn get_asset_server(&self) -> &AssetServer {
|
fn get_asset_server(&self) -> &AssetServer {
|
||||||
self.resource()
|
self.resource()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GetAssetServer for AssetServer {
|
impl GetAssetServer for AssetServer {
|
||||||
fn get_asset_server(&self) -> &AssetServer {
|
fn get_asset_server(&self) -> &AssetServer {
|
||||||
self
|
self
|
||||||
|
@ -223,6 +223,7 @@ pub struct ReflectHandle {
|
|||||||
downcast_handle_untyped: fn(&dyn Any) -> Option<UntypedHandle>,
|
downcast_handle_untyped: fn(&dyn Any) -> Option<UntypedHandle>,
|
||||||
typed: fn(UntypedHandle) -> Box<dyn Reflect>,
|
typed: fn(UntypedHandle) -> Box<dyn Reflect>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ReflectHandle {
|
impl ReflectHandle {
|
||||||
/// The [`TypeId`] of the asset
|
/// The [`TypeId`] of the asset
|
||||||
pub fn asset_type_id(&self) -> TypeId {
|
pub fn asset_type_id(&self) -> TypeId {
|
||||||
|
@ -57,6 +57,7 @@ pub struct PlaybackRemoveMarker;
|
|||||||
pub(crate) struct EarPositions<'w, 's> {
|
pub(crate) struct EarPositions<'w, 's> {
|
||||||
pub(crate) query: Query<'w, 's, (Entity, &'static GlobalTransform, &'static SpatialListener)>,
|
pub(crate) query: Query<'w, 's, (Entity, &'static GlobalTransform, &'static SpatialListener)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'w, 's> EarPositions<'w, 's> {
|
impl<'w, 's> EarPositions<'w, 's> {
|
||||||
/// Gets a set of transformed ear positions.
|
/// Gets a set of transformed ear positions.
|
||||||
///
|
///
|
||||||
|
@ -80,6 +80,7 @@ impl From<TextureUsages> for Camera3dDepthTextureUsage {
|
|||||||
Self(value.bits())
|
Self(value.bits())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Camera3dDepthTextureUsage> for TextureUsages {
|
impl From<Camera3dDepthTextureUsage> for TextureUsages {
|
||||||
fn from(value: Camera3dDepthTextureUsage) -> Self {
|
fn from(value: Camera3dDepthTextureUsage) -> Self {
|
||||||
Self::from_bits_truncate(value.0)
|
Self::from_bits_truncate(value.0)
|
||||||
|
@ -17,11 +17,13 @@ pub struct FrameTimeDiagnosticsPlugin {
|
|||||||
/// The smoothing factor for the exponential moving average. Usually `2.0 / (history_length + 1.0)`.
|
/// The smoothing factor for the exponential moving average. Usually `2.0 / (history_length + 1.0)`.
|
||||||
pub smoothing_factor: f64,
|
pub smoothing_factor: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for FrameTimeDiagnosticsPlugin {
|
impl Default for FrameTimeDiagnosticsPlugin {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new(DEFAULT_MAX_HISTORY_LENGTH)
|
Self::new(DEFAULT_MAX_HISTORY_LENGTH)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FrameTimeDiagnosticsPlugin {
|
impl FrameTimeDiagnosticsPlugin {
|
||||||
/// Creates a new `FrameTimeDiagnosticsPlugin` with the specified `max_history_length` and a
|
/// Creates a new `FrameTimeDiagnosticsPlugin` with the specified `max_history_length` and a
|
||||||
/// reasonable `smoothing_factor`.
|
/// reasonable `smoothing_factor`.
|
||||||
|
@ -960,6 +960,7 @@ impl Index<RangeFrom<ArchetypeGeneration>> for Archetypes {
|
|||||||
&self.archetypes[index.start.0.index()..]
|
&self.archetypes[index.start.0.index()..]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Index<ArchetypeId> for Archetypes {
|
impl Index<ArchetypeId> for Archetypes {
|
||||||
type Output = Archetype;
|
type Output = Archetype;
|
||||||
|
|
||||||
|
@ -623,6 +623,7 @@ pub trait ComponentMutability: private::Seal + 'static {
|
|||||||
pub struct Immutable;
|
pub struct Immutable;
|
||||||
|
|
||||||
impl private::Seal for Immutable {}
|
impl private::Seal for Immutable {}
|
||||||
|
|
||||||
impl ComponentMutability for Immutable {
|
impl ComponentMutability for Immutable {
|
||||||
const MUTABLE: bool = false;
|
const MUTABLE: bool = false;
|
||||||
}
|
}
|
||||||
@ -633,6 +634,7 @@ impl ComponentMutability for Immutable {
|
|||||||
pub struct Mutable;
|
pub struct Mutable;
|
||||||
|
|
||||||
impl private::Seal for Mutable {}
|
impl private::Seal for Mutable {}
|
||||||
|
|
||||||
impl ComponentMutability for Mutable {
|
impl ComponentMutability for Mutable {
|
||||||
const MUTABLE: bool = true;
|
const MUTABLE: bool = true;
|
||||||
}
|
}
|
||||||
@ -2968,6 +2970,7 @@ impl<T> Default for DefaultCloneBehaviorSpecialization<T> {
|
|||||||
pub trait DefaultCloneBehaviorBase {
|
pub trait DefaultCloneBehaviorBase {
|
||||||
fn default_clone_behavior(&self) -> ComponentCloneBehavior;
|
fn default_clone_behavior(&self) -> ComponentCloneBehavior;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C> DefaultCloneBehaviorBase for DefaultCloneBehaviorSpecialization<C> {
|
impl<C> DefaultCloneBehaviorBase for DefaultCloneBehaviorSpecialization<C> {
|
||||||
fn default_clone_behavior(&self) -> ComponentCloneBehavior {
|
fn default_clone_behavior(&self) -> ComponentCloneBehavior {
|
||||||
ComponentCloneBehavior::Default
|
ComponentCloneBehavior::Default
|
||||||
@ -2979,6 +2982,7 @@ impl<C> DefaultCloneBehaviorBase for DefaultCloneBehaviorSpecialization<C> {
|
|||||||
pub trait DefaultCloneBehaviorViaClone {
|
pub trait DefaultCloneBehaviorViaClone {
|
||||||
fn default_clone_behavior(&self) -> ComponentCloneBehavior;
|
fn default_clone_behavior(&self) -> ComponentCloneBehavior;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C: Clone + Component> DefaultCloneBehaviorViaClone for &DefaultCloneBehaviorSpecialization<C> {
|
impl<C: Clone + Component> DefaultCloneBehaviorViaClone for &DefaultCloneBehaviorSpecialization<C> {
|
||||||
fn default_clone_behavior(&self) -> ComponentCloneBehavior {
|
fn default_clone_behavior(&self) -> ComponentCloneBehavior {
|
||||||
ComponentCloneBehavior::clone::<C>()
|
ComponentCloneBehavior::clone::<C>()
|
||||||
|
@ -718,6 +718,7 @@ impl<'a> Iterator for ReserveEntitiesIterator<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ExactSizeIterator for ReserveEntitiesIterator<'a> {}
|
impl<'a> ExactSizeIterator for ReserveEntitiesIterator<'a> {}
|
||||||
|
|
||||||
impl<'a> core::iter::FusedIterator for ReserveEntitiesIterator<'a> {}
|
impl<'a> core::iter::FusedIterator for ReserveEntitiesIterator<'a> {}
|
||||||
|
|
||||||
// SAFETY: Newly reserved entity values are unique.
|
// SAFETY: Newly reserved entity values are unique.
|
||||||
|
@ -154,6 +154,7 @@ impl<T: EntityEquivalent, const N: usize> DerefMut for UniqueEntityEquivalentArr
|
|||||||
unsafe { UniqueEntityEquivalentSlice::from_slice_unchecked_mut(&mut self.0) }
|
unsafe { UniqueEntityEquivalentSlice::from_slice_unchecked_mut(&mut self.0) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: EntityEquivalent> Default for UniqueEntityEquivalentArray<T, 0> {
|
impl<T: EntityEquivalent> Default for UniqueEntityEquivalentArray<T, 0> {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self(Default::default())
|
Self(Default::default())
|
||||||
@ -527,6 +528,7 @@ impl<T: PartialEq<U>, U: EntityEquivalent, const N: usize>
|
|||||||
self.eq(&other.0)
|
self.eq(&other.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: PartialEq<U>, U: EntityEquivalent, const N: usize>
|
impl<T: PartialEq<U>, U: EntityEquivalent, const N: usize>
|
||||||
PartialEq<&UniqueEntityEquivalentArray<U, N>> for VecDeque<T>
|
PartialEq<&UniqueEntityEquivalentArray<U, N>> for VecDeque<T>
|
||||||
{
|
{
|
||||||
@ -550,6 +552,7 @@ impl<T: PartialEq<U>, U: EntityEquivalent, const N: usize>
|
|||||||
self.eq(&other.0)
|
self.eq(&other.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: PartialEq<U>, U: EntityEquivalent, const N: usize>
|
impl<T: PartialEq<U>, U: EntityEquivalent, const N: usize>
|
||||||
PartialEq<UniqueEntityEquivalentArray<U, N>> for VecDeque<T>
|
PartialEq<UniqueEntityEquivalentArray<U, N>> for VecDeque<T>
|
||||||
{
|
{
|
||||||
|
@ -159,6 +159,7 @@ impl From<&str> for Name {
|
|||||||
Name::new(name.to_owned())
|
Name::new(name.to_owned())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<String> for Name {
|
impl From<String> for Name {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn from(name: String) -> Self {
|
fn from(name: String) -> Self {
|
||||||
@ -174,12 +175,14 @@ impl AsRef<str> for Name {
|
|||||||
&self.name
|
&self.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&Name> for String {
|
impl From<&Name> for String {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn from(val: &Name) -> String {
|
fn from(val: &Name) -> String {
|
||||||
val.as_str().to_owned()
|
val.as_str().to_owned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Name> for String {
|
impl From<Name> for String {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn from(val: Name) -> String {
|
fn from(val: Name) -> String {
|
||||||
|
@ -1489,6 +1489,7 @@ impl<T: Component> Clone for ReadFetch<'_, T> {
|
|||||||
*self
|
*self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Component> Copy for ReadFetch<'_, T> {}
|
impl<T: Component> Copy for ReadFetch<'_, T> {}
|
||||||
|
|
||||||
/// SAFETY:
|
/// SAFETY:
|
||||||
@ -1665,6 +1666,7 @@ impl<T: Component> Clone for RefFetch<'_, T> {
|
|||||||
*self
|
*self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Component> Copy for RefFetch<'_, T> {}
|
impl<T: Component> Copy for RefFetch<'_, T> {}
|
||||||
|
|
||||||
/// SAFETY:
|
/// SAFETY:
|
||||||
@ -1873,6 +1875,7 @@ impl<T: Component> Clone for WriteFetch<'_, T> {
|
|||||||
*self
|
*self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Component> Copy for WriteFetch<'_, T> {}
|
impl<T: Component> Copy for WriteFetch<'_, T> {}
|
||||||
|
|
||||||
/// SAFETY:
|
/// SAFETY:
|
||||||
|
@ -1240,6 +1240,7 @@ unsafe impl QueryFilter for Spawned {
|
|||||||
pub trait ArchetypeFilter: QueryFilter {}
|
pub trait ArchetypeFilter: QueryFilter {}
|
||||||
|
|
||||||
impl<T: Component> ArchetypeFilter for With<T> {}
|
impl<T: Component> ArchetypeFilter for With<T> {}
|
||||||
|
|
||||||
impl<T: Component> ArchetypeFilter for Without<T> {}
|
impl<T: Component> ArchetypeFilter for Without<T> {}
|
||||||
|
|
||||||
macro_rules! impl_archetype_filter_tuple {
|
macro_rules! impl_archetype_filter_tuple {
|
||||||
|
@ -51,6 +51,7 @@ pub(super) trait ScheduleBuildPassObj: Send + Sync + Debug {
|
|||||||
);
|
);
|
||||||
fn add_dependency(&mut self, from: NodeId, to: NodeId, all_options: &TypeIdMap<Box<dyn Any>>);
|
fn add_dependency(&mut self, from: NodeId, to: NodeId, all_options: &TypeIdMap<Box<dyn Any>>);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: ScheduleBuildPass> ScheduleBuildPassObj for T {
|
impl<T: ScheduleBuildPass> ScheduleBuildPassObj for T {
|
||||||
fn build(
|
fn build(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
@ -235,6 +235,7 @@ pub enum Chain {
|
|||||||
/// will be added between the successive elements.
|
/// will be added between the successive elements.
|
||||||
Chained(TypeIdMap<Box<dyn Any>>),
|
Chained(TypeIdMap<Box<dyn Any>>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Chain {
|
impl Chain {
|
||||||
/// Specify that the systems must be chained.
|
/// Specify that the systems must be chained.
|
||||||
pub fn set_chained(&mut self) {
|
pub fn set_chained(&mut self) {
|
||||||
|
@ -210,6 +210,7 @@ unsafe impl<R: Relationship, L: SpawnableList<R> + Send + Sync + 'static> Bundle
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<R: Relationship, L: SpawnableList<R>> DynamicBundle for SpawnRelatedBundle<R, L> {
|
impl<R: Relationship, L: SpawnableList<R>> DynamicBundle for SpawnRelatedBundle<R, L> {
|
||||||
type Effect = Self;
|
type Effect = Self;
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ where
|
|||||||
InfallibleObserverWrapper::new(IntoSystem::into_system(this))
|
InfallibleObserverWrapper::new(IntoSystem::into_system(this))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<E, B, M, S> IntoObserverSystem<E, B, (Never, M), Result> for S
|
impl<E, B, M, S> IntoObserverSystem<E, B, (Never, M), Result> for S
|
||||||
where
|
where
|
||||||
S: IntoSystem<On<'static, E, B>, Never, M> + Send + 'static,
|
S: IntoSystem<On<'static, E, B>, Never, M> + Send + 'static,
|
||||||
|
@ -1400,6 +1400,7 @@ impl<'w, T> Deref for NonSend<'w, T> {
|
|||||||
self.value
|
self.value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> From<NonSendMut<'a, T>> for NonSend<'a, T> {
|
impl<'a, T> From<NonSendMut<'a, T>> for NonSend<'a, T> {
|
||||||
fn from(nsm: NonSendMut<'a, T>) -> Self {
|
fn from(nsm: NonSendMut<'a, T>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -47,6 +47,7 @@ pub(crate) struct Gilrs {
|
|||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
cell: SyncCell<gilrs::Gilrs>,
|
cell: SyncCell<gilrs::Gilrs>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Gilrs {
|
impl Gilrs {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn with(&mut self, f: impl FnOnce(&mut gilrs::Gilrs)) {
|
pub fn with(&mut self, f: impl FnOnce(&mut gilrs::Gilrs)) {
|
||||||
|
@ -172,6 +172,7 @@ where
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Config, Clear> GizmoBuffer<Config, Clear>
|
impl<Config, Clear> GizmoBuffer<Config, Clear>
|
||||||
where
|
where
|
||||||
Config: GizmoConfigGroup,
|
Config: GizmoConfigGroup,
|
||||||
|
@ -34,6 +34,7 @@ pub struct TextureAtlasSources {
|
|||||||
/// Maps from a specific image handle to the index in `textures` where they can be found.
|
/// Maps from a specific image handle to the index in `textures` where they can be found.
|
||||||
pub texture_ids: HashMap<AssetId<Image>, usize>,
|
pub texture_ids: HashMap<AssetId<Image>, usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TextureAtlasSources {
|
impl TextureAtlasSources {
|
||||||
/// Retrieves the texture *section* index of the given `texture` handle.
|
/// Retrieves the texture *section* index of the given `texture` handle.
|
||||||
pub fn texture_index(&self, texture: impl Into<AssetId<Image>>) -> Option<usize> {
|
pub fn texture_index(&self, texture: impl Into<AssetId<Image>>) -> Option<usize> {
|
||||||
|
@ -1347,6 +1347,7 @@ pub struct RationalSegment<P: VectorSpace> {
|
|||||||
/// The width of the domain of this segment.
|
/// The width of the domain of this segment.
|
||||||
pub knot_span: f32,
|
pub knot_span: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<P: VectorSpace<Scalar = f32>> RationalSegment<P> {
|
impl<P: VectorSpace<Scalar = f32>> RationalSegment<P> {
|
||||||
/// Instantaneous position of a point at parametric value `t` in `[0, 1]`.
|
/// Instantaneous position of a point at parametric value `t` in `[0, 1]`.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -35,6 +35,7 @@ pub struct Circle {
|
|||||||
/// The radius of the circle
|
/// The radius of the circle
|
||||||
pub radius: f32,
|
pub radius: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive2d for Circle {}
|
impl Primitive2d for Circle {}
|
||||||
|
|
||||||
impl Default for Circle {
|
impl Default for Circle {
|
||||||
@ -124,6 +125,7 @@ pub struct Arc2d {
|
|||||||
/// Half the angle defining the arc
|
/// Half the angle defining the arc
|
||||||
pub half_angle: f32,
|
pub half_angle: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive2d for Arc2d {}
|
impl Primitive2d for Arc2d {}
|
||||||
|
|
||||||
impl Default for Arc2d {
|
impl Default for Arc2d {
|
||||||
@ -290,6 +292,7 @@ pub struct CircularSector {
|
|||||||
#[cfg_attr(all(feature = "serialize", feature = "alloc"), serde(flatten))]
|
#[cfg_attr(all(feature = "serialize", feature = "alloc"), serde(flatten))]
|
||||||
pub arc: Arc2d,
|
pub arc: Arc2d,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive2d for CircularSector {}
|
impl Primitive2d for CircularSector {}
|
||||||
|
|
||||||
impl Default for CircularSector {
|
impl Default for CircularSector {
|
||||||
@ -433,6 +436,7 @@ pub struct CircularSegment {
|
|||||||
#[cfg_attr(all(feature = "serialize", feature = "alloc"), serde(flatten))]
|
#[cfg_attr(all(feature = "serialize", feature = "alloc"), serde(flatten))]
|
||||||
pub arc: Arc2d,
|
pub arc: Arc2d,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive2d for CircularSegment {}
|
impl Primitive2d for CircularSegment {}
|
||||||
|
|
||||||
impl Default for CircularSegment {
|
impl Default for CircularSegment {
|
||||||
@ -453,6 +457,7 @@ impl Measured2d for CircularSegment {
|
|||||||
self.chord_length() + self.arc_length()
|
self.chord_length() + self.arc_length()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CircularSegment {
|
impl CircularSegment {
|
||||||
/// Create a new [`CircularSegment`] from a `radius`, and an `angle`
|
/// Create a new [`CircularSegment`] from a `radius`, and an `angle`
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
@ -788,6 +793,7 @@ pub struct Ellipse {
|
|||||||
/// This corresponds to the two perpendicular radii defining the ellipse.
|
/// This corresponds to the two perpendicular radii defining the ellipse.
|
||||||
pub half_size: Vec2,
|
pub half_size: Vec2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive2d for Ellipse {}
|
impl Primitive2d for Ellipse {}
|
||||||
|
|
||||||
impl Default for Ellipse {
|
impl Default for Ellipse {
|
||||||
@ -939,6 +945,7 @@ pub struct Annulus {
|
|||||||
/// The outer circle of the annulus
|
/// The outer circle of the annulus
|
||||||
pub outer_circle: Circle,
|
pub outer_circle: Circle,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive2d for Annulus {}
|
impl Primitive2d for Annulus {}
|
||||||
|
|
||||||
impl Default for Annulus {
|
impl Default for Annulus {
|
||||||
@ -1036,6 +1043,7 @@ pub struct Rhombus {
|
|||||||
/// Size of the horizontal and vertical diagonals of the rhombus
|
/// Size of the horizontal and vertical diagonals of the rhombus
|
||||||
pub half_diagonals: Vec2,
|
pub half_diagonals: Vec2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive2d for Rhombus {}
|
impl Primitive2d for Rhombus {}
|
||||||
|
|
||||||
impl Default for Rhombus {
|
impl Default for Rhombus {
|
||||||
@ -1171,6 +1179,7 @@ pub struct Plane2d {
|
|||||||
/// The normal of the plane. The plane will be placed perpendicular to this direction
|
/// The normal of the plane. The plane will be placed perpendicular to this direction
|
||||||
pub normal: Dir2,
|
pub normal: Dir2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive2d for Plane2d {}
|
impl Primitive2d for Plane2d {}
|
||||||
|
|
||||||
impl Default for Plane2d {
|
impl Default for Plane2d {
|
||||||
@ -1213,6 +1222,7 @@ pub struct Line2d {
|
|||||||
/// and its opposite direction
|
/// and its opposite direction
|
||||||
pub direction: Dir2,
|
pub direction: Dir2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive2d for Line2d {}
|
impl Primitive2d for Line2d {}
|
||||||
|
|
||||||
/// A line segment defined by two endpoints in 2D space.
|
/// A line segment defined by two endpoints in 2D space.
|
||||||
@ -1232,6 +1242,7 @@ pub struct Segment2d {
|
|||||||
/// The endpoints of the line segment.
|
/// The endpoints of the line segment.
|
||||||
pub vertices: [Vec2; 2],
|
pub vertices: [Vec2; 2],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive2d for Segment2d {}
|
impl Primitive2d for Segment2d {}
|
||||||
|
|
||||||
impl Segment2d {
|
impl Segment2d {
|
||||||
@ -1504,6 +1515,7 @@ pub struct Polyline2d<const N: usize> {
|
|||||||
#[cfg_attr(feature = "serialize", serde(with = "super::serde::array"))]
|
#[cfg_attr(feature = "serialize", serde(with = "super::serde::array"))]
|
||||||
pub vertices: [Vec2; N],
|
pub vertices: [Vec2; N],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<const N: usize> Primitive2d for Polyline2d<N> {}
|
impl<const N: usize> Primitive2d for Polyline2d<N> {}
|
||||||
|
|
||||||
impl<const N: usize> FromIterator<Vec2> for Polyline2d<N> {
|
impl<const N: usize> FromIterator<Vec2> for Polyline2d<N> {
|
||||||
@ -1573,6 +1585,7 @@ pub struct Triangle2d {
|
|||||||
/// The vertices of the triangle
|
/// The vertices of the triangle
|
||||||
pub vertices: [Vec2; 3],
|
pub vertices: [Vec2; 3],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive2d for Triangle2d {}
|
impl Primitive2d for Triangle2d {}
|
||||||
|
|
||||||
impl Default for Triangle2d {
|
impl Default for Triangle2d {
|
||||||
@ -1745,6 +1758,7 @@ pub struct Rectangle {
|
|||||||
/// Half of the width and height of the rectangle
|
/// Half of the width and height of the rectangle
|
||||||
pub half_size: Vec2,
|
pub half_size: Vec2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive2d for Rectangle {}
|
impl Primitive2d for Rectangle {}
|
||||||
|
|
||||||
impl Default for Rectangle {
|
impl Default for Rectangle {
|
||||||
@ -1838,6 +1852,7 @@ pub struct Polygon<const N: usize> {
|
|||||||
#[cfg_attr(feature = "serialize", serde(with = "super::serde::array"))]
|
#[cfg_attr(feature = "serialize", serde(with = "super::serde::array"))]
|
||||||
pub vertices: [Vec2; N],
|
pub vertices: [Vec2; N],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<const N: usize> Primitive2d for Polygon<N> {}
|
impl<const N: usize> Primitive2d for Polygon<N> {}
|
||||||
|
|
||||||
impl<const N: usize> FromIterator<Vec2> for Polygon<N> {
|
impl<const N: usize> FromIterator<Vec2> for Polygon<N> {
|
||||||
@ -1892,6 +1907,7 @@ pub struct ConvexPolygon<const N: usize> {
|
|||||||
#[cfg_attr(feature = "serialize", serde(with = "super::serde::array"))]
|
#[cfg_attr(feature = "serialize", serde(with = "super::serde::array"))]
|
||||||
vertices: [Vec2; N],
|
vertices: [Vec2; N],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<const N: usize> Primitive2d for ConvexPolygon<N> {}
|
impl<const N: usize> Primitive2d for ConvexPolygon<N> {}
|
||||||
|
|
||||||
/// An error that happens when creating a [`ConvexPolygon`].
|
/// An error that happens when creating a [`ConvexPolygon`].
|
||||||
@ -2013,6 +2029,7 @@ pub struct RegularPolygon {
|
|||||||
/// The number of sides
|
/// The number of sides
|
||||||
pub sides: u32,
|
pub sides: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive2d for RegularPolygon {}
|
impl Primitive2d for RegularPolygon {}
|
||||||
|
|
||||||
impl Default for RegularPolygon {
|
impl Default for RegularPolygon {
|
||||||
@ -2160,6 +2177,7 @@ pub struct Capsule2d {
|
|||||||
/// Half the height of the capsule, excluding the semicircles
|
/// Half the height of the capsule, excluding the semicircles
|
||||||
pub half_length: f32,
|
pub half_length: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive2d for Capsule2d {}
|
impl Primitive2d for Capsule2d {}
|
||||||
|
|
||||||
impl Default for Capsule2d {
|
impl Default for Capsule2d {
|
||||||
|
@ -31,6 +31,7 @@ pub struct Sphere {
|
|||||||
/// The radius of the sphere
|
/// The radius of the sphere
|
||||||
pub radius: f32,
|
pub radius: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive3d for Sphere {}
|
impl Primitive3d for Sphere {}
|
||||||
|
|
||||||
impl Default for Sphere {
|
impl Default for Sphere {
|
||||||
@ -105,6 +106,7 @@ pub struct Plane3d {
|
|||||||
/// Half of the width and height of the plane
|
/// Half of the width and height of the plane
|
||||||
pub half_size: Vec2,
|
pub half_size: Vec2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive3d for Plane3d {}
|
impl Primitive3d for Plane3d {}
|
||||||
|
|
||||||
impl Default for Plane3d {
|
impl Default for Plane3d {
|
||||||
@ -175,6 +177,7 @@ pub struct InfinitePlane3d {
|
|||||||
/// The normal of the plane. The plane will be placed perpendicular to this direction
|
/// The normal of the plane. The plane will be placed perpendicular to this direction
|
||||||
pub normal: Dir3,
|
pub normal: Dir3,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive3d for InfinitePlane3d {}
|
impl Primitive3d for InfinitePlane3d {}
|
||||||
|
|
||||||
impl Default for InfinitePlane3d {
|
impl Default for InfinitePlane3d {
|
||||||
@ -351,6 +354,7 @@ pub struct Line3d {
|
|||||||
/// The direction of the line
|
/// The direction of the line
|
||||||
pub direction: Dir3,
|
pub direction: Dir3,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive3d for Line3d {}
|
impl Primitive3d for Line3d {}
|
||||||
|
|
||||||
/// A line segment defined by two endpoints in 3D space.
|
/// A line segment defined by two endpoints in 3D space.
|
||||||
@ -370,6 +374,7 @@ pub struct Segment3d {
|
|||||||
/// The endpoints of the line segment.
|
/// The endpoints of the line segment.
|
||||||
pub vertices: [Vec3; 2],
|
pub vertices: [Vec3; 2],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive3d for Segment3d {}
|
impl Primitive3d for Segment3d {}
|
||||||
|
|
||||||
impl Segment3d {
|
impl Segment3d {
|
||||||
@ -578,6 +583,7 @@ pub struct Polyline3d<const N: usize> {
|
|||||||
#[cfg_attr(feature = "serialize", serde(with = "super::serde::array"))]
|
#[cfg_attr(feature = "serialize", serde(with = "super::serde::array"))]
|
||||||
pub vertices: [Vec3; N],
|
pub vertices: [Vec3; N],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<const N: usize> Primitive3d for Polyline3d<N> {}
|
impl<const N: usize> Primitive3d for Polyline3d<N> {}
|
||||||
|
|
||||||
impl<const N: usize> FromIterator<Vec3> for Polyline3d<N> {
|
impl<const N: usize> FromIterator<Vec3> for Polyline3d<N> {
|
||||||
@ -648,6 +654,7 @@ pub struct Cuboid {
|
|||||||
/// Half of the width, height and depth of the cuboid
|
/// Half of the width, height and depth of the cuboid
|
||||||
pub half_size: Vec3,
|
pub half_size: Vec3,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive3d for Cuboid {}
|
impl Primitive3d for Cuboid {}
|
||||||
|
|
||||||
impl Default for Cuboid {
|
impl Default for Cuboid {
|
||||||
@ -742,6 +749,7 @@ pub struct Cylinder {
|
|||||||
/// The half height of the cylinder
|
/// The half height of the cylinder
|
||||||
pub half_height: f32,
|
pub half_height: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive3d for Cylinder {}
|
impl Primitive3d for Cylinder {}
|
||||||
|
|
||||||
impl Default for Cylinder {
|
impl Default for Cylinder {
|
||||||
@ -820,6 +828,7 @@ pub struct Capsule3d {
|
|||||||
/// Half the height of the capsule, excluding the hemispheres
|
/// Half the height of the capsule, excluding the hemispheres
|
||||||
pub half_length: f32,
|
pub half_length: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive3d for Capsule3d {}
|
impl Primitive3d for Capsule3d {}
|
||||||
|
|
||||||
impl Default for Capsule3d {
|
impl Default for Capsule3d {
|
||||||
@ -890,6 +899,7 @@ pub struct Cone {
|
|||||||
/// The height of the cone
|
/// The height of the cone
|
||||||
pub height: f32,
|
pub height: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive3d for Cone {}
|
impl Primitive3d for Cone {}
|
||||||
|
|
||||||
impl Default for Cone {
|
impl Default for Cone {
|
||||||
@ -974,6 +984,7 @@ pub struct ConicalFrustum {
|
|||||||
/// The height of the frustum
|
/// The height of the frustum
|
||||||
pub height: f32,
|
pub height: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive3d for ConicalFrustum {}
|
impl Primitive3d for ConicalFrustum {}
|
||||||
|
|
||||||
impl Default for ConicalFrustum {
|
impl Default for ConicalFrustum {
|
||||||
@ -1030,6 +1041,7 @@ pub struct Torus {
|
|||||||
#[doc(alias = "radius_of_revolution")]
|
#[doc(alias = "radius_of_revolution")]
|
||||||
pub major_radius: f32,
|
pub major_radius: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive3d for Torus {}
|
impl Primitive3d for Torus {}
|
||||||
|
|
||||||
impl Default for Torus {
|
impl Default for Torus {
|
||||||
@ -1326,6 +1338,7 @@ pub struct Tetrahedron {
|
|||||||
/// The vertices of the tetrahedron.
|
/// The vertices of the tetrahedron.
|
||||||
pub vertices: [Vec3; 4],
|
pub vertices: [Vec3; 4],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Primitive3d for Tetrahedron {}
|
impl Primitive3d for Tetrahedron {}
|
||||||
|
|
||||||
impl Default for Tetrahedron {
|
impl Default for Tetrahedron {
|
||||||
@ -1433,6 +1446,7 @@ pub struct Extrusion<T: Primitive2d> {
|
|||||||
/// Half of the depth of the extrusion
|
/// Half of the depth of the extrusion
|
||||||
pub half_depth: f32,
|
pub half_depth: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Primitive2d> Primitive3d for Extrusion<T> {}
|
impl<T: Primitive2d> Primitive3d for Extrusion<T> {}
|
||||||
|
|
||||||
impl<T: Primitive2d> Extrusion<T> {
|
impl<T: Primitive2d> Extrusion<T> {
|
||||||
|
@ -34,6 +34,7 @@ struct SweepLineEvent {
|
|||||||
/// Type of the vertex (left or right)
|
/// Type of the vertex (left or right)
|
||||||
endpoint: Endpoint,
|
endpoint: Endpoint,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SweepLineEvent {
|
impl SweepLineEvent {
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
not(feature = "alloc"),
|
not(feature = "alloc"),
|
||||||
@ -46,17 +47,21 @@ impl SweepLineEvent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PartialEq for SweepLineEvent {
|
impl PartialEq for SweepLineEvent {
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
self.position() == other.position()
|
self.position() == other.position()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Eq for SweepLineEvent {}
|
impl Eq for SweepLineEvent {}
|
||||||
|
|
||||||
impl PartialOrd for SweepLineEvent {
|
impl PartialOrd for SweepLineEvent {
|
||||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||||
Some(self.cmp(other))
|
Some(self.cmp(other))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Ord for SweepLineEvent {
|
impl Ord for SweepLineEvent {
|
||||||
fn cmp(&self, other: &Self) -> Ordering {
|
fn cmp(&self, other: &Self) -> Ordering {
|
||||||
xy_order(self.position(), other.position())
|
xy_order(self.position(), other.position())
|
||||||
@ -129,11 +134,13 @@ struct Segment {
|
|||||||
left: Vec2,
|
left: Vec2,
|
||||||
right: Vec2,
|
right: Vec2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PartialEq for Segment {
|
impl PartialEq for Segment {
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
self.edge_index == other.edge_index
|
self.edge_index == other.edge_index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Eq for Segment {}
|
impl Eq for Segment {}
|
||||||
|
|
||||||
impl PartialOrd for Segment {
|
impl PartialOrd for Segment {
|
||||||
@ -141,6 +148,7 @@ impl PartialOrd for Segment {
|
|||||||
Some(self.cmp(other))
|
Some(self.cmp(other))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Ord for Segment {
|
impl Ord for Segment {
|
||||||
fn cmp(&self, other: &Self) -> Ordering {
|
fn cmp(&self, other: &Self) -> Ordering {
|
||||||
self.left
|
self.left
|
||||||
|
@ -163,6 +163,7 @@ impl Iterator for IndicesIter<'_> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ExactSizeIterator for IndicesIter<'a> {}
|
impl<'a> ExactSizeIterator for IndicesIter<'a> {}
|
||||||
|
|
||||||
impl<'a> FusedIterator for IndicesIter<'a> {}
|
impl<'a> FusedIterator for IndicesIter<'a> {}
|
||||||
|
|
||||||
impl From<&Indices> for IndexFormat {
|
impl From<&Indices> for IndexFormat {
|
||||||
|
@ -117,6 +117,7 @@ pub struct MorphWeights {
|
|||||||
/// The first mesh primitive assigned to these weights
|
/// The first mesh primitive assigned to these weights
|
||||||
first_mesh: Option<Handle<Mesh>>,
|
first_mesh: Option<Handle<Mesh>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MorphWeights {
|
impl MorphWeights {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
weights: Vec<f32>,
|
weights: Vec<f32>,
|
||||||
@ -160,6 +161,7 @@ impl MorphWeights {
|
|||||||
pub struct MeshMorphWeights {
|
pub struct MeshMorphWeights {
|
||||||
weights: Vec<f32>,
|
weights: Vec<f32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MeshMorphWeights {
|
impl MeshMorphWeights {
|
||||||
pub fn new(weights: Vec<f32>) -> Result<Self, MorphBuildError> {
|
pub fn new(weights: Vec<f32>) -> Result<Self, MorphBuildError> {
|
||||||
if weights.len() > MAX_MORPH_WEIGHTS {
|
if weights.len() > MAX_MORPH_WEIGHTS {
|
||||||
@ -198,6 +200,7 @@ pub struct MorphAttributes {
|
|||||||
/// animated, as the `w` component is the sign and cannot be animated.
|
/// animated, as the `w` component is the sign and cannot be animated.
|
||||||
pub tangent: Vec3,
|
pub tangent: Vec3,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<[Vec3; 3]> for MorphAttributes {
|
impl From<[Vec3; 3]> for MorphAttributes {
|
||||||
fn from([position, normal, tangent]: [Vec3; 3]) -> Self {
|
fn from([position, normal, tangent]: [Vec3; 3]) -> Self {
|
||||||
MorphAttributes {
|
MorphAttributes {
|
||||||
@ -207,6 +210,7 @@ impl From<[Vec3; 3]> for MorphAttributes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MorphAttributes {
|
impl MorphAttributes {
|
||||||
/// How many components `MorphAttributes` has.
|
/// How many components `MorphAttributes` has.
|
||||||
///
|
///
|
||||||
|
@ -48,6 +48,7 @@ impl Default for AmbientLight {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AmbientLight {
|
impl AmbientLight {
|
||||||
pub const NONE: AmbientLight = AmbientLight {
|
pub const NONE: AmbientLight = AmbientLight {
|
||||||
color: Color::WHITE,
|
color: Color::WHITE,
|
||||||
|
@ -33,6 +33,7 @@ pub enum ParallaxMappingMethod {
|
|||||||
max_steps: u32,
|
max_steps: u32,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ParallaxMappingMethod {
|
impl ParallaxMappingMethod {
|
||||||
/// [`ParallaxMappingMethod::Relief`] with a 5 steps, a reasonable default.
|
/// [`ParallaxMappingMethod::Relief`] with a 5 steps, a reasonable default.
|
||||||
pub const DEFAULT_RELIEF_MAPPING: Self = ParallaxMappingMethod::Relief { max_steps: 5 };
|
pub const DEFAULT_RELIEF_MAPPING: Self = ParallaxMappingMethod::Relief { max_steps: 5 };
|
||||||
|
@ -27,7 +27,9 @@ pub struct Unaligned;
|
|||||||
/// Trait that is only implemented for [`Aligned`] and [`Unaligned`] to work around the lack of ability
|
/// Trait that is only implemented for [`Aligned`] and [`Unaligned`] to work around the lack of ability
|
||||||
/// to have const generics of an enum.
|
/// to have const generics of an enum.
|
||||||
pub trait IsAligned: sealed::Sealed {}
|
pub trait IsAligned: sealed::Sealed {}
|
||||||
|
|
||||||
impl IsAligned for Aligned {}
|
impl IsAligned for Aligned {}
|
||||||
|
|
||||||
impl IsAligned for Unaligned {}
|
impl IsAligned for Unaligned {}
|
||||||
|
|
||||||
mod sealed {
|
mod sealed {
|
||||||
|
@ -439,6 +439,7 @@ impl PartialReflect for DynamicFunction<'static> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl MaybeTyped for DynamicFunction<'static> {}
|
impl MaybeTyped for DynamicFunction<'static> {}
|
||||||
|
|
||||||
impl RegisterForReflection for DynamicFunction<'static> {}
|
impl RegisterForReflection for DynamicFunction<'static> {}
|
||||||
|
|
||||||
impl_type_path!((in bevy_reflect) DynamicFunction<'env>);
|
impl_type_path!((in bevy_reflect) DynamicFunction<'env>);
|
||||||
|
@ -90,6 +90,7 @@ impl<'a, 'b> ArgListSignature<'a, 'b> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Eq for ArgListSignature<'_, '_> {}
|
impl Eq for ArgListSignature<'_, '_> {}
|
||||||
|
|
||||||
impl PartialEq for ArgListSignature<'_, '_> {
|
impl PartialEq for ArgListSignature<'_, '_> {
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
self.len() == other.len() && self.iter().eq(other.iter())
|
self.len() == other.len() && self.iter().eq(other.iter())
|
||||||
|
@ -77,6 +77,7 @@ where
|
|||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: SmallArray + TypePath + Send + Sync> PartialReflect for SmallVec<T>
|
impl<T: SmallArray + TypePath + Send + Sync> PartialReflect for SmallVec<T>
|
||||||
where
|
where
|
||||||
T::Item: FromReflect + MaybeTyped + TypePath,
|
T::Item: FromReflect + MaybeTyped + TypePath,
|
||||||
|
@ -220,6 +220,7 @@ pub enum ReflectRef<'a> {
|
|||||||
/// [opaque]: ReflectKind::Opaque
|
/// [opaque]: ReflectKind::Opaque
|
||||||
Opaque(&'a dyn PartialReflect),
|
Opaque(&'a dyn PartialReflect),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_reflect_kind_conversions!(ReflectRef<'_>);
|
impl_reflect_kind_conversions!(ReflectRef<'_>);
|
||||||
|
|
||||||
impl<'a> ReflectRef<'a> {
|
impl<'a> ReflectRef<'a> {
|
||||||
@ -285,6 +286,7 @@ pub enum ReflectMut<'a> {
|
|||||||
/// [opaque]: ReflectKind::Opaque
|
/// [opaque]: ReflectKind::Opaque
|
||||||
Opaque(&'a mut dyn PartialReflect),
|
Opaque(&'a mut dyn PartialReflect),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_reflect_kind_conversions!(ReflectMut<'_>);
|
impl_reflect_kind_conversions!(ReflectMut<'_>);
|
||||||
|
|
||||||
impl<'a> ReflectMut<'a> {
|
impl<'a> ReflectMut<'a> {
|
||||||
@ -350,6 +352,7 @@ pub enum ReflectOwned {
|
|||||||
/// [opaque]: ReflectKind::Opaque
|
/// [opaque]: ReflectKind::Opaque
|
||||||
Opaque(Box<dyn PartialReflect>),
|
Opaque(Box<dyn PartialReflect>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_reflect_kind_conversions!(ReflectOwned);
|
impl_reflect_kind_conversions!(ReflectOwned);
|
||||||
|
|
||||||
impl ReflectOwned {
|
impl ReflectOwned {
|
||||||
|
@ -74,6 +74,7 @@ impl<'a> AccessError<'a> {
|
|||||||
self.offset.as_ref()
|
self.offset.as_ref()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for AccessError<'_> {
|
impl fmt::Display for AccessError<'_> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let AccessError {
|
let AccessError {
|
||||||
@ -126,4 +127,5 @@ impl fmt::Display for AccessError<'_> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl core::error::Error for AccessError<'_> {}
|
impl core::error::Error for AccessError<'_> {}
|
||||||
|
@ -82,6 +82,7 @@ pub trait ReflectPath<'a>: Sized {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ReflectPath<'a> for &'a str {
|
impl<'a> ReflectPath<'a> for &'a str {
|
||||||
fn reflect_element(self, mut root: &dyn PartialReflect) -> PathResult<'a, &dyn PartialReflect> {
|
fn reflect_element(self, mut root: &dyn PartialReflect) -> PathResult<'a, &dyn PartialReflect> {
|
||||||
for (access, offset) in PathParser::new(self) {
|
for (access, offset) in PathParser::new(self) {
|
||||||
@ -437,6 +438,7 @@ impl ParsedPath {
|
|||||||
Ok(Self(parts))
|
Ok(Self(parts))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ReflectPath<'a> for &'a ParsedPath {
|
impl<'a> ReflectPath<'a> for &'a ParsedPath {
|
||||||
fn reflect_element(self, mut root: &dyn PartialReflect) -> PathResult<'a, &dyn PartialReflect> {
|
fn reflect_element(self, mut root: &dyn PartialReflect) -> PathResult<'a, &dyn PartialReflect> {
|
||||||
for OffsetAccess { access, offset } in &self.0 {
|
for OffsetAccess { access, offset } in &self.0 {
|
||||||
@ -454,11 +456,13 @@ impl<'a> ReflectPath<'a> for &'a ParsedPath {
|
|||||||
Ok(root)
|
Ok(root)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<const N: usize> From<[OffsetAccess; N]> for ParsedPath {
|
impl<const N: usize> From<[OffsetAccess; N]> for ParsedPath {
|
||||||
fn from(value: [OffsetAccess; N]) -> Self {
|
fn from(value: [OffsetAccess; N]) -> Self {
|
||||||
ParsedPath(value.to_vec())
|
ParsedPath(value.to_vec())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Vec<Access<'static>>> for ParsedPath {
|
impl From<Vec<Access<'static>>> for ParsedPath {
|
||||||
fn from(value: Vec<Access<'static>>) -> Self {
|
fn from(value: Vec<Access<'static>>) -> Self {
|
||||||
ParsedPath(
|
ParsedPath(
|
||||||
@ -472,6 +476,7 @@ impl From<Vec<Access<'static>>> for ParsedPath {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<const N: usize> From<[Access<'static>; N]> for ParsedPath {
|
impl<const N: usize> From<[Access<'static>; N]> for ParsedPath {
|
||||||
fn from(value: [Access<'static>; N]) -> Self {
|
fn from(value: [Access<'static>; N]) -> Self {
|
||||||
value.to_vec().into()
|
value.to_vec().into()
|
||||||
@ -493,12 +498,14 @@ impl fmt::Display for ParsedPath {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl core::ops::Index<usize> for ParsedPath {
|
impl core::ops::Index<usize> for ParsedPath {
|
||||||
type Output = OffsetAccess;
|
type Output = OffsetAccess;
|
||||||
fn index(&self, index: usize) -> &Self::Output {
|
fn index(&self, index: usize) -> &Self::Output {
|
||||||
&self.0[index]
|
&self.0[index]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl core::ops::IndexMut<usize> for ParsedPath {
|
impl core::ops::IndexMut<usize> for ParsedPath {
|
||||||
fn index_mut(&mut self, index: usize) -> &mut Self::Output {
|
fn index_mut(&mut self, index: usize) -> &mut Self::Output {
|
||||||
&mut self.0[index]
|
&mut self.0[index]
|
||||||
|
@ -38,6 +38,7 @@ pub(super) struct PathParser<'a> {
|
|||||||
path: &'a str,
|
path: &'a str,
|
||||||
remaining: &'a [u8],
|
remaining: &'a [u8],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> PathParser<'a> {
|
impl<'a> PathParser<'a> {
|
||||||
pub(super) fn new(path: &'a str) -> Self {
|
pub(super) fn new(path: &'a str) -> Self {
|
||||||
let remaining = path.as_bytes();
|
let remaining = path.as_bytes();
|
||||||
@ -103,6 +104,7 @@ impl<'a> PathParser<'a> {
|
|||||||
self.path.len() - self.remaining.len()
|
self.path.len() - self.remaining.len()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Iterator for PathParser<'a> {
|
impl<'a> Iterator for PathParser<'a> {
|
||||||
type Item = (Result<Access<'a>, ReflectPathError<'a>>, usize);
|
type Item = (Result<Access<'a>, ReflectPathError<'a>>, usize);
|
||||||
|
|
||||||
@ -149,6 +151,7 @@ enum Token<'a> {
|
|||||||
CloseBracket = b']',
|
CloseBracket = b']',
|
||||||
Ident(Ident<'a>),
|
Ident(Ident<'a>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Token<'_> {
|
impl fmt::Display for Token<'_> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
@ -160,6 +163,7 @@ impl fmt::Display for Token<'_> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Token<'a> {
|
impl<'a> Token<'a> {
|
||||||
const SYMBOLS: &'static [u8] = b".#[]";
|
const SYMBOLS: &'static [u8] = b".#[]";
|
||||||
fn symbol_from_byte(byte: u8) -> Option<Self> {
|
fn symbol_from_byte(byte: u8) -> Option<Self> {
|
||||||
|
@ -649,17 +649,29 @@ macro_rules! impl_reflect_tuple {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl_reflect_tuple! {}
|
impl_reflect_tuple! {}
|
||||||
|
|
||||||
impl_reflect_tuple! {0: A}
|
impl_reflect_tuple! {0: A}
|
||||||
|
|
||||||
impl_reflect_tuple! {0: A, 1: B}
|
impl_reflect_tuple! {0: A, 1: B}
|
||||||
|
|
||||||
impl_reflect_tuple! {0: A, 1: B, 2: C}
|
impl_reflect_tuple! {0: A, 1: B, 2: C}
|
||||||
|
|
||||||
impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D}
|
impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D}
|
||||||
|
|
||||||
impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E}
|
impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E}
|
||||||
|
|
||||||
impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F}
|
impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F}
|
||||||
|
|
||||||
impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G}
|
impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G}
|
||||||
|
|
||||||
impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H}
|
impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H}
|
||||||
|
|
||||||
impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H, 8: I}
|
impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H, 8: I}
|
||||||
|
|
||||||
impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H, 8: I, 9: J}
|
impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H, 8: I, 9: J}
|
||||||
|
|
||||||
impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H, 8: I, 9: J, 10: K}
|
impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H, 8: I, 9: J, 10: K}
|
||||||
|
|
||||||
impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H, 8: I, 9: J, 10: K, 11: L}
|
impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H, 8: I, 9: J, 10: K, 11: L}
|
||||||
|
|
||||||
macro_rules! impl_type_path_tuple {
|
macro_rules! impl_type_path_tuple {
|
||||||
|
@ -689,6 +689,7 @@ pub trait TypeData: Downcast + Send + Sync {
|
|||||||
/// Creates a type-erased clone of this value.
|
/// Creates a type-erased clone of this value.
|
||||||
fn clone_type_data(&self) -> Box<dyn TypeData>;
|
fn clone_type_data(&self) -> Box<dyn TypeData>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_downcast!(TypeData);
|
impl_downcast!(TypeData);
|
||||||
|
|
||||||
impl<T: 'static + Send + Sync> TypeData for T
|
impl<T: 'static + Send + Sync> TypeData for T
|
||||||
|
@ -14,6 +14,7 @@ use wgpu::{BindingResource, BufferUsages};
|
|||||||
|
|
||||||
/// Trait for types able to go in a [`GpuArrayBuffer`].
|
/// Trait for types able to go in a [`GpuArrayBuffer`].
|
||||||
pub trait GpuArrayBufferable: ShaderType + ShaderSize + WriteInto + Clone {}
|
pub trait GpuArrayBufferable: ShaderType + ShaderSize + WriteInto + Clone {}
|
||||||
|
|
||||||
impl<T: ShaderType + ShaderSize + WriteInto + Clone> GpuArrayBufferable for T {}
|
impl<T: ShaderType + ShaderSize + WriteInto + Clone> GpuArrayBufferable for T {}
|
||||||
|
|
||||||
/// Stores an array of elements to be transferred to the GPU and made accessible to shaders as a read-only array.
|
/// Stores an array of elements to be transferred to the GPU and made accessible to shaders as a read-only array.
|
||||||
|
@ -65,9 +65,11 @@ impl LocalExecutor<'_> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl UnwindSafe for Executor<'_> {}
|
impl UnwindSafe for Executor<'_> {}
|
||||||
|
|
||||||
impl RefUnwindSafe for Executor<'_> {}
|
impl RefUnwindSafe for Executor<'_> {}
|
||||||
|
|
||||||
impl UnwindSafe for LocalExecutor<'_> {}
|
impl UnwindSafe for LocalExecutor<'_> {}
|
||||||
|
|
||||||
impl RefUnwindSafe for LocalExecutor<'_> {}
|
impl RefUnwindSafe for LocalExecutor<'_> {}
|
||||||
|
|
||||||
impl fmt::Debug for Executor<'_> {
|
impl fmt::Debug for Executor<'_> {
|
||||||
|
@ -32,6 +32,7 @@ pub use conditional_send::*;
|
|||||||
/// Use [`ConditionalSendFuture`] for a future with an optional Send trait bound, as on certain platforms (eg. Wasm),
|
/// Use [`ConditionalSendFuture`] for a future with an optional Send trait bound, as on certain platforms (eg. Wasm),
|
||||||
/// futures aren't Send.
|
/// futures aren't Send.
|
||||||
pub trait ConditionalSendFuture: Future + ConditionalSend {}
|
pub trait ConditionalSendFuture: Future + ConditionalSend {}
|
||||||
|
|
||||||
impl<T: Future + ConditionalSend> ConditionalSendFuture for T {}
|
impl<T: Future + ConditionalSend> ConditionalSendFuture for T {}
|
||||||
|
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
|
@ -98,6 +98,7 @@ pub struct ThreadExecutorTicker<'task, 'ticker> {
|
|||||||
// make type not send or sync
|
// make type not send or sync
|
||||||
_marker: PhantomData<*const ()>,
|
_marker: PhantomData<*const ()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'task, 'ticker> ThreadExecutorTicker<'task, 'ticker> {
|
impl<'task, 'ticker> ThreadExecutorTicker<'task, 'ticker> {
|
||||||
/// Tick the thread executor.
|
/// Tick the thread executor.
|
||||||
pub async fn tick(&self) {
|
pub async fn tick(&self) {
|
||||||
|
@ -1043,9 +1043,11 @@ pub enum BoxSizing {
|
|||||||
/// Length styles like width and height refer to the "content box" size (size excluding padding and border)
|
/// Length styles like width and height refer to the "content box" size (size excluding padding and border)
|
||||||
ContentBox,
|
ContentBox,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BoxSizing {
|
impl BoxSizing {
|
||||||
pub const DEFAULT: Self = Self::BorderBox;
|
pub const DEFAULT: Self = Self::BorderBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for BoxSizing {
|
impl Default for BoxSizing {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::DEFAULT
|
Self::DEFAULT
|
||||||
|
@ -570,131 +570,157 @@ impl From<AppLifecycle> for WindowEvent {
|
|||||||
Self::AppLifecycle(e)
|
Self::AppLifecycle(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<CursorEntered> for WindowEvent {
|
impl From<CursorEntered> for WindowEvent {
|
||||||
fn from(e: CursorEntered) -> Self {
|
fn from(e: CursorEntered) -> Self {
|
||||||
Self::CursorEntered(e)
|
Self::CursorEntered(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<CursorLeft> for WindowEvent {
|
impl From<CursorLeft> for WindowEvent {
|
||||||
fn from(e: CursorLeft) -> Self {
|
fn from(e: CursorLeft) -> Self {
|
||||||
Self::CursorLeft(e)
|
Self::CursorLeft(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<CursorMoved> for WindowEvent {
|
impl From<CursorMoved> for WindowEvent {
|
||||||
fn from(e: CursorMoved) -> Self {
|
fn from(e: CursorMoved) -> Self {
|
||||||
Self::CursorMoved(e)
|
Self::CursorMoved(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<FileDragAndDrop> for WindowEvent {
|
impl From<FileDragAndDrop> for WindowEvent {
|
||||||
fn from(e: FileDragAndDrop) -> Self {
|
fn from(e: FileDragAndDrop) -> Self {
|
||||||
Self::FileDragAndDrop(e)
|
Self::FileDragAndDrop(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Ime> for WindowEvent {
|
impl From<Ime> for WindowEvent {
|
||||||
fn from(e: Ime) -> Self {
|
fn from(e: Ime) -> Self {
|
||||||
Self::Ime(e)
|
Self::Ime(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<RequestRedraw> for WindowEvent {
|
impl From<RequestRedraw> for WindowEvent {
|
||||||
fn from(e: RequestRedraw) -> Self {
|
fn from(e: RequestRedraw) -> Self {
|
||||||
Self::RequestRedraw(e)
|
Self::RequestRedraw(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<WindowBackendScaleFactorChanged> for WindowEvent {
|
impl From<WindowBackendScaleFactorChanged> for WindowEvent {
|
||||||
fn from(e: WindowBackendScaleFactorChanged) -> Self {
|
fn from(e: WindowBackendScaleFactorChanged) -> Self {
|
||||||
Self::WindowBackendScaleFactorChanged(e)
|
Self::WindowBackendScaleFactorChanged(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<WindowCloseRequested> for WindowEvent {
|
impl From<WindowCloseRequested> for WindowEvent {
|
||||||
fn from(e: WindowCloseRequested) -> Self {
|
fn from(e: WindowCloseRequested) -> Self {
|
||||||
Self::WindowCloseRequested(e)
|
Self::WindowCloseRequested(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<WindowCreated> for WindowEvent {
|
impl From<WindowCreated> for WindowEvent {
|
||||||
fn from(e: WindowCreated) -> Self {
|
fn from(e: WindowCreated) -> Self {
|
||||||
Self::WindowCreated(e)
|
Self::WindowCreated(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<WindowDestroyed> for WindowEvent {
|
impl From<WindowDestroyed> for WindowEvent {
|
||||||
fn from(e: WindowDestroyed) -> Self {
|
fn from(e: WindowDestroyed) -> Self {
|
||||||
Self::WindowDestroyed(e)
|
Self::WindowDestroyed(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<WindowFocused> for WindowEvent {
|
impl From<WindowFocused> for WindowEvent {
|
||||||
fn from(e: WindowFocused) -> Self {
|
fn from(e: WindowFocused) -> Self {
|
||||||
Self::WindowFocused(e)
|
Self::WindowFocused(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<WindowMoved> for WindowEvent {
|
impl From<WindowMoved> for WindowEvent {
|
||||||
fn from(e: WindowMoved) -> Self {
|
fn from(e: WindowMoved) -> Self {
|
||||||
Self::WindowMoved(e)
|
Self::WindowMoved(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<WindowOccluded> for WindowEvent {
|
impl From<WindowOccluded> for WindowEvent {
|
||||||
fn from(e: WindowOccluded) -> Self {
|
fn from(e: WindowOccluded) -> Self {
|
||||||
Self::WindowOccluded(e)
|
Self::WindowOccluded(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<WindowResized> for WindowEvent {
|
impl From<WindowResized> for WindowEvent {
|
||||||
fn from(e: WindowResized) -> Self {
|
fn from(e: WindowResized) -> Self {
|
||||||
Self::WindowResized(e)
|
Self::WindowResized(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<WindowScaleFactorChanged> for WindowEvent {
|
impl From<WindowScaleFactorChanged> for WindowEvent {
|
||||||
fn from(e: WindowScaleFactorChanged) -> Self {
|
fn from(e: WindowScaleFactorChanged) -> Self {
|
||||||
Self::WindowScaleFactorChanged(e)
|
Self::WindowScaleFactorChanged(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<WindowThemeChanged> for WindowEvent {
|
impl From<WindowThemeChanged> for WindowEvent {
|
||||||
fn from(e: WindowThemeChanged) -> Self {
|
fn from(e: WindowThemeChanged) -> Self {
|
||||||
Self::WindowThemeChanged(e)
|
Self::WindowThemeChanged(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<MouseButtonInput> for WindowEvent {
|
impl From<MouseButtonInput> for WindowEvent {
|
||||||
fn from(e: MouseButtonInput) -> Self {
|
fn from(e: MouseButtonInput) -> Self {
|
||||||
Self::MouseButtonInput(e)
|
Self::MouseButtonInput(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<MouseMotion> for WindowEvent {
|
impl From<MouseMotion> for WindowEvent {
|
||||||
fn from(e: MouseMotion) -> Self {
|
fn from(e: MouseMotion) -> Self {
|
||||||
Self::MouseMotion(e)
|
Self::MouseMotion(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<MouseWheel> for WindowEvent {
|
impl From<MouseWheel> for WindowEvent {
|
||||||
fn from(e: MouseWheel) -> Self {
|
fn from(e: MouseWheel) -> Self {
|
||||||
Self::MouseWheel(e)
|
Self::MouseWheel(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<PinchGesture> for WindowEvent {
|
impl From<PinchGesture> for WindowEvent {
|
||||||
fn from(e: PinchGesture) -> Self {
|
fn from(e: PinchGesture) -> Self {
|
||||||
Self::PinchGesture(e)
|
Self::PinchGesture(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<RotationGesture> for WindowEvent {
|
impl From<RotationGesture> for WindowEvent {
|
||||||
fn from(e: RotationGesture) -> Self {
|
fn from(e: RotationGesture) -> Self {
|
||||||
Self::RotationGesture(e)
|
Self::RotationGesture(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<DoubleTapGesture> for WindowEvent {
|
impl From<DoubleTapGesture> for WindowEvent {
|
||||||
fn from(e: DoubleTapGesture) -> Self {
|
fn from(e: DoubleTapGesture) -> Self {
|
||||||
Self::DoubleTapGesture(e)
|
Self::DoubleTapGesture(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<PanGesture> for WindowEvent {
|
impl From<PanGesture> for WindowEvent {
|
||||||
fn from(e: PanGesture) -> Self {
|
fn from(e: PanGesture) -> Self {
|
||||||
Self::PanGesture(e)
|
Self::PanGesture(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<TouchInput> for WindowEvent {
|
impl From<TouchInput> for WindowEvent {
|
||||||
fn from(e: TouchInput) -> Self {
|
fn from(e: TouchInput) -> Self {
|
||||||
Self::TouchInput(e)
|
Self::TouchInput(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<KeyboardInput> for WindowEvent {
|
impl From<KeyboardInput> for WindowEvent {
|
||||||
fn from(e: KeyboardInput) -> Self {
|
fn from(e: KeyboardInput) -> Self {
|
||||||
Self::KeyboardInput(e)
|
Self::KeyboardInput(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<KeyboardFocusLost> for WindowEvent {
|
impl From<KeyboardFocusLost> for WindowEvent {
|
||||||
fn from(e: KeyboardFocusLost) -> Self {
|
fn from(e: KeyboardFocusLost) -> Self {
|
||||||
Self::KeyboardFocusLost(e)
|
Self::KeyboardFocusLost(e)
|
||||||
|
@ -128,4 +128,5 @@ fn setup(
|
|||||||
struct MeshletDebugMaterial {
|
struct MeshletDebugMaterial {
|
||||||
_dummy: (),
|
_dummy: (),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Material for MeshletDebugMaterial {}
|
impl Material for MeshletDebugMaterial {}
|
||||||
|
@ -53,6 +53,7 @@ impl Default for CurrentMethod {
|
|||||||
CurrentMethod(ParallaxMappingMethod::Relief { max_steps: 4 })
|
CurrentMethod(ParallaxMappingMethod::Relief { max_steps: 4 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for CurrentMethod {
|
impl fmt::Display for CurrentMethod {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match self.0 {
|
match self.0 {
|
||||||
@ -63,6 +64,7 @@ impl fmt::Display for CurrentMethod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CurrentMethod {
|
impl CurrentMethod {
|
||||||
fn next_method(&mut self) {
|
fn next_method(&mut self) {
|
||||||
use ParallaxMappingMethod::*;
|
use ParallaxMappingMethod::*;
|
||||||
|
@ -4,10 +4,12 @@ use bevy::{math::VectorSpace, prelude::*};
|
|||||||
|
|
||||||
// We define this trait so we can reuse the same code for multiple color types that may be implemented using curves.
|
// We define this trait so we can reuse the same code for multiple color types that may be implemented using curves.
|
||||||
trait CurveColor: VectorSpace<Scalar = f32> + Into<Color> + Send + Sync + 'static {}
|
trait CurveColor: VectorSpace<Scalar = f32> + Into<Color> + Send + Sync + 'static {}
|
||||||
|
|
||||||
impl<T: VectorSpace<Scalar = f32> + Into<Color> + Send + Sync + 'static> CurveColor for T {}
|
impl<T: VectorSpace<Scalar = f32> + Into<Color> + Send + Sync + 'static> CurveColor for T {}
|
||||||
|
|
||||||
// We define this trait so we can reuse the same code for multiple color types that may be implemented using mixing.
|
// We define this trait so we can reuse the same code for multiple color types that may be implemented using mixing.
|
||||||
trait MixedColor: Mix + Into<Color> + Send + Sync + 'static {}
|
trait MixedColor: Mix + Into<Color> + Send + Sync + 'static {}
|
||||||
|
|
||||||
impl<T: Mix + Into<Color> + Send + Sync + 'static> MixedColor for T {}
|
impl<T: Mix + Into<Color> + Send + Sync + 'static> MixedColor for T {}
|
||||||
|
|
||||||
#[derive(Debug, Component)]
|
#[derive(Debug, Component)]
|
||||||
|
@ -63,6 +63,7 @@ fn transfer_log_events(
|
|||||||
struct CaptureLayer {
|
struct CaptureLayer {
|
||||||
sender: mpsc::Sender<LogEvent>,
|
sender: mpsc::Sender<LogEvent>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: Subscriber> Layer<S> for CaptureLayer {
|
impl<S: Subscriber> Layer<S> for CaptureLayer {
|
||||||
fn on_event(
|
fn on_event(
|
||||||
&self,
|
&self,
|
||||||
|
@ -165,6 +165,7 @@ struct StencilPipeline {
|
|||||||
/// This isn't required, it's only done like this for simplicity.
|
/// This isn't required, it's only done like this for simplicity.
|
||||||
shader_handle: Handle<Shader>,
|
shader_handle: Handle<Shader>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromWorld for StencilPipeline {
|
impl FromWorld for StencilPipeline {
|
||||||
fn from_world(world: &mut World) -> Self {
|
fn from_world(world: &mut World) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -382,6 +383,7 @@ impl GetBatchData for StencilPipeline {
|
|||||||
Some((mesh_uniform, None))
|
Some((mesh_uniform, None))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GetFullBatchData for StencilPipeline {
|
impl GetFullBatchData for StencilPipeline {
|
||||||
type BufferInputData = MeshInputUniform;
|
type BufferInputData = MeshInputUniform;
|
||||||
|
|
||||||
|
@ -193,6 +193,7 @@ struct ComputeNodeLabel;
|
|||||||
/// The node that will execute the compute shader
|
/// The node that will execute the compute shader
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct ComputeNode {}
|
struct ComputeNode {}
|
||||||
|
|
||||||
impl render_graph::Node for ComputeNode {
|
impl render_graph::Node for ComputeNode {
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
|
@ -171,6 +171,7 @@ struct CustomMeshPipeline {
|
|||||||
/// This isn't required, it's only done like this for simplicity.
|
/// This isn't required, it's only done like this for simplicity.
|
||||||
shader_handle: Handle<Shader>,
|
shader_handle: Handle<Shader>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromWorld for CustomMeshPipeline {
|
impl FromWorld for CustomMeshPipeline {
|
||||||
fn from_world(world: &mut World) -> Self {
|
fn from_world(world: &mut World) -> Self {
|
||||||
// Load the shader
|
// Load the shader
|
||||||
|
@ -48,6 +48,7 @@ struct ButtonMaterials {
|
|||||||
normal: MeshMaterial2d<ColorMaterial>,
|
normal: MeshMaterial2d<ColorMaterial>,
|
||||||
active: MeshMaterial2d<ColorMaterial>,
|
active: MeshMaterial2d<ColorMaterial>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromWorld for ButtonMaterials {
|
impl FromWorld for ButtonMaterials {
|
||||||
fn from_world(world: &mut World) -> Self {
|
fn from_world(world: &mut World) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -63,6 +64,7 @@ struct ButtonMeshes {
|
|||||||
start_pause: Mesh2d,
|
start_pause: Mesh2d,
|
||||||
trigger: Mesh2d,
|
trigger: Mesh2d,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromWorld for ButtonMeshes {
|
impl FromWorld for ButtonMeshes {
|
||||||
fn from_world(world: &mut World) -> Self {
|
fn from_world(world: &mut World) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -11,6 +11,7 @@ struct Clips {
|
|||||||
nodes: Vec<AnimationNodeIndex>,
|
nodes: Vec<AnimationNodeIndex>,
|
||||||
current: usize,
|
current: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Clips {
|
impl Clips {
|
||||||
fn new(clips: Vec<AnimationNodeIndex>) -> Self {
|
fn new(clips: Vec<AnimationNodeIndex>) -> Self {
|
||||||
Clips {
|
Clips {
|
||||||
|
@ -80,6 +80,7 @@ enum WeightChange {
|
|||||||
Increase,
|
Increase,
|
||||||
Decrease,
|
Decrease,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WeightChange {
|
impl WeightChange {
|
||||||
fn reverse(&mut self) {
|
fn reverse(&mut self) {
|
||||||
*self = match *self {
|
*self = match *self {
|
||||||
@ -112,6 +113,7 @@ struct Target {
|
|||||||
weight: f32,
|
weight: f32,
|
||||||
change_dir: WeightChange,
|
change_dir: WeightChange,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Target {
|
impl fmt::Display for Target {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match (self.name.as_ref(), self.entity_name.as_ref()) {
|
match (self.name.as_ref(), self.entity_name.as_ref()) {
|
||||||
@ -123,6 +125,7 @@ impl fmt::Display for Target {
|
|||||||
write!(f, ": {}", self.weight)
|
write!(f, ": {}", self.weight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Target {
|
impl Target {
|
||||||
fn text_span(&self, key: &str, style: TextFont) -> (TextSpan, TextFont) {
|
fn text_span(&self, key: &str, style: TextFont) -> (TextSpan, TextFont) {
|
||||||
(TextSpan::new(format!("[{key}] {self}\n")), style)
|
(TextSpan::new(format!("[{key}] {self}\n")), style)
|
||||||
@ -160,6 +163,7 @@ struct MorphKey {
|
|||||||
modifiers: &'static [KeyCode],
|
modifiers: &'static [KeyCode],
|
||||||
key: KeyCode,
|
key: KeyCode,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MorphKey {
|
impl MorphKey {
|
||||||
const fn new(name: &'static str, modifiers: &'static [KeyCode], key: KeyCode) -> Self {
|
const fn new(name: &'static str, modifiers: &'static [KeyCode], key: KeyCode) -> Self {
|
||||||
MorphKey {
|
MorphKey {
|
||||||
|
@ -94,6 +94,7 @@ enum SettingType {
|
|||||||
Shape,
|
Shape,
|
||||||
Samples,
|
Samples,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SettingType {
|
impl SettingType {
|
||||||
fn label(&self) -> &str {
|
fn label(&self) -> &str {
|
||||||
match self {
|
match self {
|
||||||
|
Loading…
Reference in New Issue
Block a user