|
1 | 1 | use crate::bindings::{
|
2 |
| - access_map::{DisplayCodeLocation, ReflectAccessId}, function::namespace::Namespace, |
3 |
| - pretty_print::DisplayWithWorld, script_value::ScriptValue, ReflectBaseType, ReflectReference, |
| 2 | + access_map::{DisplayCodeLocation, ReflectAccessId}, |
| 3 | + function::namespace::Namespace, |
| 4 | + pretty_print::DisplayWithWorld, |
| 5 | + script_value::ScriptValue, |
| 6 | + ReflectBaseType, ReflectReference, |
4 | 7 | };
|
5 | 8 | use bevy::{
|
6 | 9 | ecs::component::ComponentId,
|
7 | 10 | prelude::Entity,
|
8 | 11 | reflect::{func::FunctionError, PartialReflect, Reflect},
|
9 | 12 | };
|
10 | 13 | use std::{
|
11 |
| - any::TypeId, borrow::Cow, fmt::{Debug, Display}, ops::Deref, str::Utf8Error, sync::Arc |
| 14 | + any::TypeId, |
| 15 | + borrow::Cow, |
| 16 | + fmt::{Debug, Display}, |
| 17 | + ops::Deref, |
| 18 | + str::Utf8Error, |
| 19 | + sync::Arc, |
12 | 20 | };
|
13 | 21 |
|
14 | 22 | pub type ScriptResult<T> = Result<T, ScriptError>;
|
@@ -494,8 +502,14 @@ impl InteropError {
|
494 | 502 | }))
|
495 | 503 | }
|
496 | 504 |
|
497 |
| - pub fn unregistered_component_or_resource_type(type_name: impl Into<Cow<'static, str>>) -> Self { |
498 |
| - Self(Arc::new(InteropErrorInner::UnregisteredComponentOrResourceType { type_name: type_name.into() })) |
| 505 | + pub fn unregistered_component_or_resource_type( |
| 506 | + type_name: impl Into<Cow<'static, str>>, |
| 507 | + ) -> Self { |
| 508 | + Self(Arc::new( |
| 509 | + InteropErrorInner::UnregisteredComponentOrResourceType { |
| 510 | + type_name: type_name.into(), |
| 511 | + }, |
| 512 | + )) |
499 | 513 | }
|
500 | 514 |
|
501 | 515 | pub fn inner(&self) -> &InteropErrorInner {
|
@@ -789,14 +803,16 @@ macro_rules! invariant {
|
789 | 803 |
|
790 | 804 | macro_rules! unregistered_component_or_resource_type {
|
791 | 805 | ($type_name:expr) => {
|
792 |
| - format!("Expected registered component/resource but got unregistered type: {}", $type_name) |
| 806 | + format!( |
| 807 | + "Expected registered component/resource but got unregistered type: {}", |
| 808 | + $type_name |
| 809 | + ) |
793 | 810 | };
|
794 | 811 | }
|
795 | 812 |
|
796 | 813 | impl DisplayWithWorld for InteropErrorInner {
|
797 | 814 | fn display_with_world(&self, world: crate::bindings::WorldGuard) -> String {
|
798 | 815 | match self {
|
799 |
| - |
800 | 816 | InteropErrorInner::MissingFunctionError { on, function_name } => {
|
801 | 817 | missing_function_error!(function_name, on.display_with_world(world))
|
802 | 818 | },
|
|
0 commit comments