aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-02 04:22:30 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-02 04:22:30 +0800
commit8128f2c94313b2e9b9d0b5c3350623f77bbb2521 (patch)
tree9e542eeaaae148b8cccaa01608d75ed1fc463869 /mingling_core/src
parent3f24e5b6ead1e153408ae5e58ad34636fe614645 (diff)
chore: run cargo fmt and rearrange re-exports in minglingnext
Diffstat (limited to 'mingling_core/src')
-rw-r--r--mingling_core/src/any.rs7
-rw-r--r--mingling_core/src/asset/global_resource.rs9
-rw-r--r--mingling_core/src/renderer.rs2
-rw-r--r--mingling_core/src/renderer/structural.rs21
4 files changed, 20 insertions, 19 deletions
diff --git a/mingling_core/src/any.rs b/mingling_core/src/any.rs
index b586f09..2680f43 100644
--- a/mingling_core/src/any.rs
+++ b/mingling_core/src/any.rs
@@ -1,5 +1,5 @@
-use crate::{Groupped, ProgramCollect};
use crate::error::ChainProcessError;
+use crate::{Groupped, ProgramCollect};
#[doc(hidden)]
pub mod group;
@@ -136,7 +136,10 @@ impl<G> From<AnyOutput<G>> for ChainProcess<G> {
}
}
-impl<G> From<()> for ChainProcess<G> where G: ProgramCollect<Enum = G> {
+impl<G> From<()> for ChainProcess<G>
+where
+ G: ProgramCollect<Enum = G>,
+{
fn from(_v: ()) -> Self {
G::build_empty_result().route_chain()
}
diff --git a/mingling_core/src/asset/global_resource.rs b/mingling_core/src/asset/global_resource.rs
index 651655a..3d0af7b 100644
--- a/mingling_core/src/asset/global_resource.rs
+++ b/mingling_core/src/asset/global_resource.rs
@@ -80,9 +80,7 @@ where
/// owned value. The caller must call [`__store_res`] to write back modifications.
#[doc(hidden)]
#[must_use]
- pub fn __extract_res_mut<Res: 'static + Default + ResourceMarker + Send + Sync>(
- &self,
- ) -> Res {
+ pub fn __extract_res_mut<Res: 'static + Default + ResourceMarker + Send + Sync>(&self) -> Res {
let Ok(mut guard) = self.resources.lock() else {
return Res::res_default();
};
@@ -103,10 +101,7 @@ where
///
/// Stores a modified resource value back into the global store.
#[doc(hidden)]
- pub fn __store_res<Res: 'static + Send + Sync + ResourceMarker>(
- &self,
- val: Res,
- ) {
+ pub fn __store_res<Res: 'static + Send + Sync + ResourceMarker>(&self, val: Res) {
if let Ok(mut guard) = self.resources.lock() {
guard.insert(TypeId::of::<Res>(), Box::new(Arc::new(val)));
}
diff --git a/mingling_core/src/renderer.rs b/mingling_core/src/renderer.rs
index 435518d..6e67431 100644
--- a/mingling_core/src/renderer.rs
+++ b/mingling_core/src/renderer.rs
@@ -1,3 +1,3 @@
+pub mod render_result;
#[cfg(feature = "structural_renderer")]
pub mod structural;
-pub mod render_result;
diff --git a/mingling_core/src/renderer/structural.rs b/mingling_core/src/renderer/structural.rs
index 16ce471..30255aa 100644
--- a/mingling_core/src/renderer/structural.rs
+++ b/mingling_core/src/renderer/structural.rs
@@ -1,5 +1,6 @@
use crate::{
- StructuralRendererSetting, RenderResult, renderer::structural::error::StructuralRendererSerializeError,
+ RenderResult, StructuralRendererSetting,
+ renderer::structural::error::StructuralRendererSerializeError,
};
use serde::Serialize;
@@ -103,9 +104,7 @@ impl StructuralRenderer {
data: &T,
r: &mut RenderResult,
) -> Result<(), StructuralRendererSerializeError> {
- let pretty_config = ron::ser::PrettyConfig::new()
- .new_line("\n")
- .indentor(" ");
+ let pretty_config = ron::ser::PrettyConfig::new().new_line("\n").indentor(" ");
let ron_string = ron::ser::to_string_pretty(data, pretty_config)
.map_err(|e| StructuralRendererSerializeError::new(e.to_string()))?;
@@ -123,8 +122,8 @@ impl StructuralRenderer {
data: &T,
r: &mut RenderResult,
) -> Result<(), StructuralRendererSerializeError> {
- let toml_string =
- toml::to_string(data).map_err(|e| StructuralRendererSerializeError::new(e.to_string()))?;
+ let toml_string = toml::to_string(data)
+ .map_err(|e| StructuralRendererSerializeError::new(e.to_string()))?;
r.print(&toml_string);
Ok(())
}
@@ -196,8 +195,11 @@ mod tests {
#[test]
fn test_render_to_json_pretty() {
let mut r = RenderResult::default();
- let result =
- StructuralRenderer::render(&test_data(), &StructuralRendererSetting::JsonPretty, &mut r);
+ let result = StructuralRenderer::render(
+ &test_data(),
+ &StructuralRendererSetting::JsonPretty,
+ &mut r,
+ );
assert!(result.is_ok());
let output: String = r.into();
// Pretty JSON has newlines
@@ -261,7 +263,8 @@ mod tests {
#[test]
fn test_render_dispatches_json() {
let mut r = RenderResult::default();
- let result = StructuralRenderer::render(&test_data(), &StructuralRendererSetting::Json, &mut r);
+ let result =
+ StructuralRenderer::render(&test_data(), &StructuralRendererSetting::Json, &mut r);
assert!(result.is_ok());
assert!(!r.is_empty());
}