Skip to main content

Vine/Server/Notification/Support/
RelayToSky.rs

1//! Shared helper for notification atoms that are pure renderer-event
2//! relays.
3//!
4//! Many Cocoon → Mountain notification atoms do exactly two things:
5//!
6//! 1. `Host.EmitToRenderer(SkyEvent, Parameter)`
7//! 2. `dev_log!(tag, "...")`
8//!
9//! This function collapses that pair so each such atom is a one-liner. It
10//! takes `&dyn VineHost`, decoupling the handler tree from any specific
11//! embedder runtime.
12//!
13//! - `SkyEvent` - the `sky://…` renderer event name.
14//! - `LogTag`   - dev-log tag (`"grpc"`, `"output-verbose"`, …).
15//! - `LogLine`  - pre-formatted message; skipped when empty.
16
17use serde_json::Value;
18
19use crate::{Host::VineHost, dev_log};
20
21pub fn Fn(Host:&dyn VineHost, SkyEvent:&str, Parameter:&Value, LogTag:&str, LogLine:&str) {
22	Host.EmitToRenderer(SkyEvent, Parameter.clone());
23
24	if !LogLine.is_empty() {
25		dev_log!(LogTag, "{}", LogLine);
26	}
27}