Skip to main content

install_control_lib

Function install_control_lib 

Source
pub fn install_control_lib(cx: &mut Cx) -> Result<()>
Expand description

Installs the control organ into cx: loads ControlLib idempotently, installs the default control policy, and publishes the organ’s claims.

This is the first-reach entry point for the crate; everything else hangs off the functions and policy it registers.

§Examples

use std::sync::Arc;

use sim_kernel::{Cx, DefaultFactory, NoopEvalPolicy};
use sim_lib_control::install_control_lib;

let mut cx = Cx::new(Arc::new(NoopEvalPolicy), Arc::new(DefaultFactory));
install_control_lib(&mut cx).expect("install control organ");
// Idempotent: installing twice is a no-op on the second call.
install_control_lib(&mut cx).expect("reinstall is idempotent");