diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-03-31 11:43:07 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-03-31 11:43:07 +0800 |
| commit | a1503fef9947732994d4fb866b90b665c846b547 (patch) | |
| tree | 1542c91bad27df973993a862dcf49ee472e976f9 /mingling_core | |
| parent | 5a56cfd5e5ee7cde191b4c4fb24c6d11638f75fa (diff) | |
Update mingling_core to version 0.1.2 and use local dependencies
- Replace registry dependencies with local path dependencies
- Bump mingling_core version from 0.1.1 to 0.1.2
- Add safety comments for unsafe downcast operations
Diffstat (limited to 'mingling_core')
| -rw-r--r-- | mingling_core/Cargo.lock | 2 | ||||
| -rw-r--r-- | mingling_core/Cargo.toml | 2 | ||||
| -rw-r--r-- | mingling_core/src/program.rs | 8 |
3 files changed, 8 insertions, 4 deletions
diff --git a/mingling_core/Cargo.lock b/mingling_core/Cargo.lock index 070d244..5def9e6 100644 --- a/mingling_core/Cargo.lock +++ b/mingling_core/Cargo.lock @@ -16,7 +16,7 @@ checksum = "5454cda0d57db59778608d7a47bff5b16c6705598265869fb052b657f66cf05e" [[package]] name = "mingling_core" -version = "0.1.1" +version = "0.1.2" dependencies = [ "just_fmt", "serde", diff --git a/mingling_core/Cargo.toml b/mingling_core/Cargo.toml index c642c70..40b4c41 100644 --- a/mingling_core/Cargo.toml +++ b/mingling_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mingling_core" -version = "0.1.1" +version = "0.1.2" edition = "2024" license = "MIT OR Apache-2.0" description = "Core of the mingling library" diff --git a/mingling_core/src/program.rs b/mingling_core/src/program.rs index 1f234af..b13a879 100644 --- a/mingling_core/src/program.rs +++ b/mingling_core/src/program.rs @@ -93,7 +93,9 @@ macro_rules! __dispatch_program_renderers { match any.type_id { $( id if id == std::any::TypeId::of::<$prev_ty>() => { - let value = any.downcast::<$prev_ty>().unwrap(); + // SAFETY: The `type_id` check ensures that `any` contains a value of type `$chain_prev`, + // so downcasting to `$chain_prev` is safe. + let value = unsafe { any.downcast::<$prev_ty>().unwrap_unchecked() }; <$render_ty as mingling::Renderer>::render(value, r); } )* @@ -115,7 +117,9 @@ macro_rules! __dispatch_program_chains { match any.type_id { $( id if id == std::any::TypeId::of::<$chain_prev>() => { - let value = any.downcast::<$chain_prev>().unwrap(); + // SAFETY: The `type_id` check ensures that `any` contains a value of type `$chain_prev`, + // so downcasting to `$chain_prev` is safe. + let value = unsafe { any.downcast::<$chain_prev>().unwrap_unchecked() }; let fut = async { <$chain_ty as mingling::Chain>::proc(value).await }; Box::pin(fut) } |
