pub struct ClosureBridge {
pub begin_edit: Box<dyn Fn(u32) + Send + Sync>,
pub set_param: Box<dyn Fn(u32, f64) + Send + Sync>,
pub end_edit: Box<dyn Fn(u32) + Send + Sync>,
pub request_resize: Box<dyn Fn(u32, u32) -> bool + Send + Sync>,
pub get_param: Box<dyn Fn(u32) -> f64 + Send + Sync>,
pub get_param_plain: Box<dyn Fn(u32) -> f64 + Send + Sync>,
pub format_param: Box<dyn Fn(u32) -> String + Send + Sync>,
pub get_meter: Box<dyn Fn(u32) -> f32 + Send + Sync>,
pub get_state: Box<dyn Fn() -> Vec<u8> + Send + Sync>,
pub set_state: Box<dyn Fn(Vec<u8>) + Send + Sync>,
pub transport: Box<dyn Fn() -> Option<TransportInfo> + Send + Sync>,
}Expand description
Adapter that implements EditorBridge over per-method closures.
Format wrappers that prefer to compose state inline via closures
construct one of these and wrap it in an Arc<dyn EditorBridge>.
Wrappers that already have a typed host-pointer struct should
impl EditorBridge for that struct directly and skip this
adapter; one less layer of indirection per call.
Fields§
§begin_edit: Box<dyn Fn(u32) + Send + Sync>§set_param: Box<dyn Fn(u32, f64) + Send + Sync>§end_edit: Box<dyn Fn(u32) + Send + Sync>§request_resize: Box<dyn Fn(u32, u32) -> bool + Send + Sync>§get_param: Box<dyn Fn(u32) -> f64 + Send + Sync>§get_param_plain: Box<dyn Fn(u32) -> f64 + Send + Sync>§format_param: Box<dyn Fn(u32) -> String + Send + Sync>§get_meter: Box<dyn Fn(u32) -> f32 + Send + Sync>§get_state: Box<dyn Fn() -> Vec<u8> + Send + Sync>§set_state: Box<dyn Fn(Vec<u8>) + Send + Sync>§transport: Box<dyn Fn() -> Option<TransportInfo> + Send + Sync>Trait Implementations§
Source§impl EditorBridge for ClosureBridge
impl EditorBridge for ClosureBridge
Source§fn begin_edit(&self, id: u32)
fn begin_edit(&self, id: u32)
Start an automation gesture for
id. Hosts that show “touched”
state in the automation lane use this to render the
in-progress edit.Source§fn set_param(&self, id: u32, normalized: f64)
fn set_param(&self, id: u32, normalized: f64)
Set parameter
id to normalized (clamped to 0.0..=1.0).
Format wrappers usually plumb this through both the plugin’s
own param store and the host’s automation channel.Source§fn end_edit(&self, id: u32)
fn end_edit(&self, id: u32)
End the automation gesture started by
Self::begin_edit.Source§fn request_resize(&self, w: u32, h: u32) -> bool
fn request_resize(&self, w: u32, h: u32) -> bool
Ask the host to resize the editor window to
(w, h) logical
points. Returns true if the host accepted the request.Source§fn get_param(&self, id: u32) -> f64
fn get_param(&self, id: u32) -> f64
Read the parameter’s current normalized value from the plugin
(host→GUI sync path).
Source§fn get_param_plain(&self, id: u32) -> f64
fn get_param_plain(&self, id: u32) -> f64
Read the parameter’s current plain (denormalized) value.
Source§fn format_param(&self, id: u32) -> String
fn format_param(&self, id: u32) -> String
Format the parameter’s current value as a display string,
applying the plugin’s
format_value impl + unit suffix.Source§fn get_meter(&self, id: u32) -> f32
fn get_meter(&self, id: u32) -> f32
Read a meter value (0.0–1.0) by meter ID. Returns 0.0 if the
meter ID isn’t registered.
Source§fn get_state(&self) -> Vec<u8> ⓘ
fn get_state(&self) -> Vec<u8> ⓘ
Read the plugin’s custom state (everything outside the
parameter system). Returns an empty
Vec when the plugin has
no custom state.Source§fn set_state(&self, data: Vec<u8>)
fn set_state(&self, data: Vec<u8>)
Write custom state back to the plugin (calls
load_state()).Source§fn transport(&self) -> Option<TransportInfo>
fn transport(&self) -> Option<TransportInfo>
Most-recently-reported host transport state, or
None if the
host does not expose transport to plugin editors or the plugin
has not yet received a process block. Read moreSource§fn format_param_into(&self, id: u32, out: &mut String)
fn format_param_into(&self, id: u32, out: &mut String)
Format into a caller-provided buffer instead of returning a
fresh
String. The default impl calls
Self::format_param and copies, so the bridge-internal
allocation still happens; the win for the caller is that the
out buffer’s capacity is reused across calls (e.g.
ParamCache::sync polls one label per changed param per
frame and would otherwise drop+reallocate the cached
String slot every time). Bridges that produce the formatted
string from raw value bytes can override to drop the
internal allocation too.Auto Trait Implementations§
impl Freeze for ClosureBridge
impl !RefUnwindSafe for ClosureBridge
impl Send for ClosureBridge
impl Sync for ClosureBridge
impl Unpin for ClosureBridge
impl UnsafeUnpin for ClosureBridge
impl !UnwindSafe for ClosureBridge
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more