Skip to content

Commit 51887fb

Browse files
committed
Fix suggest lookup
1 parent 687f089 commit 51887fb

File tree

6 files changed

+17
-9
lines changed

6 files changed

+17
-9
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "divvun-runtime"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
edition = "2024"
55
repository = "https://github.com/divvun/divvun-runtime"
66
license = "MIT OR Apache-2.0"

macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "divvun-runtime-macros"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
edition = "2021"
55

66
[lib]

playground/src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "divvun-rt-playground"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
description = "A Tauri App"
55
authors = ["you"]
66
edition = "2021"

src/ast/mod.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,11 +506,19 @@ impl Pipe {
506506
})
507507
}
508508

509-
pub fn command<T: CommandRunner>(&self, key: &str) -> Option<&T> {
509+
pub fn command<T: CommandRunner>(&self, key: Option<&str>) -> Option<&T> {
510+
if let Some(key) = key {
511+
return self
512+
.modules
513+
.get(key)
514+
.map(|x| &**x as &(dyn Any + Send + Sync))
515+
.and_then(|x| x.downcast_ref::<T>());
516+
}
517+
510518
self.modules
511-
.get(key)
519+
.values()
512520
.map(|x| &**x as &(dyn Any + Send + Sync))
513-
.and_then(|x| x.downcast_ref::<T>())
521+
.find_map(|x| x.downcast_ref::<T>())
514522
}
515523

516524
pub async fn create_stream(

src/bundle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ impl Bundle {
214214
&self.pipe.defn
215215
}
216216

217-
pub fn command<T: modules::CommandRunner>(&self, key: &str) -> Option<&T> {
217+
pub fn command<T: modules::CommandRunner>(&self, key: Option<&str>) -> Option<&T> {
218218
self.pipe.command(key)
219219
}
220220

0 commit comments

Comments
 (0)