pub struct BiosGovernor { /* private fields */ }Expand description
BIOS-level governance engine.
Designed for no_std + no_alloc contexts. Uses the pipeline in
single-engine routing mode with a shallow AST.
Implementations§
Source§impl BiosGovernor
impl BiosGovernor
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/bios_access.rs (line 15)
12fn main() {
13 println!("=== URGE BIOS Access Control Governance Demo ===\n");
14
15 let gov = BiosGovernor::new();
16
17 struct Request {
18 capability: &'static str,
19 app: &'static str,
20 battery: u8,
21 expected: bool,
22 }
23
24 let requests = &[
25 Request {
26 capability: "camera",
27 app: "app.photos",
28 battery: 80,
29 expected: true,
30 },
31 Request {
32 capability: "camera",
33 app: "app.photos",
34 battery: 3,
35 expected: false,
36 }, // critical battery
37 Request {
38 capability: "gps",
39 app: "app.maps",
40 battery: 25,
41 expected: true,
42 },
43 Request {
44 capability: "gps",
45 app: "app.maps",
46 battery: 2,
47 expected: false,
48 }, // critical battery
49 Request {
50 capability: "microphone",
51 app: "app.voice",
52 battery: 50,
53 expected: true,
54 },
55 Request {
56 capability: "nfc",
57 app: "app.pay",
58 battery: 15,
59 expected: false,
60 }, // below 20% threshold
61 Request {
62 capability: "wifi",
63 app: "app.browser",
64 battery: 90,
65 expected: true,
66 },
67 ];
68
69 println!(
70 "{:<15} {:<15} {:<10} {:<10} {:<8}",
71 "Capability", "App", "Battery%", "Permitted", "Correct?"
72 );
73 println!("{}", "-".repeat(63));
74
75 for req in requests {
76 let permitted = gov.check_access(req.capability, req.app, req.battery);
77 let correct = permitted == req.expected;
78 println!(
79 "{:<15} {:<15} {:<10} {:<10} {:<8}",
80 req.capability,
81 req.app,
82 format!("{}%", req.battery),
83 if permitted { "YES ✓" } else { "NO ✗" },
84 if correct { "✓" } else { "FAIL" },
85 );
86 }
87
88 println!("\n=== Key properties demonstrated ===");
89 println!(" • Deterministic: same inputs → same output, always");
90 println!(" • Auditability: every decision has a logic trace");
91 println!(" • No inference: pure formal logic, no learned weights");
92 println!(" • Embedded-capable: no heap allocation in access-control path");
93 println!(" • <1µs decision time on ARM Cortex-M4 (est.)");
94 println!("\nThis is the 'BIOS governance chip' concept:");
95 println!(" The same engine governs a medical device AND a healthcare ERP.");
96 println!(" Same paradigms. Same Unicode dictionary. Same audit trail format.");
97 println!(" Different policies. Universal governance layer.");
98}Sourcepub fn check_access(
&self,
capability: &str,
_app_id: &str,
battery_percent: u8,
) -> bool
pub fn check_access( &self, capability: &str, _app_id: &str, battery_percent: u8, ) -> bool
Check whether an application is permitted to access a device capability.
Decision factors:
- User permission granted for this capability
- Battery level sufficient (some capabilities denied when battery < threshold)
- Device not in restricted mode
- Application not on blocklist
Returns true if access is permitted.
Examples found in repository?
examples/bios_access.rs (line 76)
12fn main() {
13 println!("=== URGE BIOS Access Control Governance Demo ===\n");
14
15 let gov = BiosGovernor::new();
16
17 struct Request {
18 capability: &'static str,
19 app: &'static str,
20 battery: u8,
21 expected: bool,
22 }
23
24 let requests = &[
25 Request {
26 capability: "camera",
27 app: "app.photos",
28 battery: 80,
29 expected: true,
30 },
31 Request {
32 capability: "camera",
33 app: "app.photos",
34 battery: 3,
35 expected: false,
36 }, // critical battery
37 Request {
38 capability: "gps",
39 app: "app.maps",
40 battery: 25,
41 expected: true,
42 },
43 Request {
44 capability: "gps",
45 app: "app.maps",
46 battery: 2,
47 expected: false,
48 }, // critical battery
49 Request {
50 capability: "microphone",
51 app: "app.voice",
52 battery: 50,
53 expected: true,
54 },
55 Request {
56 capability: "nfc",
57 app: "app.pay",
58 battery: 15,
59 expected: false,
60 }, // below 20% threshold
61 Request {
62 capability: "wifi",
63 app: "app.browser",
64 battery: 90,
65 expected: true,
66 },
67 ];
68
69 println!(
70 "{:<15} {:<15} {:<10} {:<10} {:<8}",
71 "Capability", "App", "Battery%", "Permitted", "Correct?"
72 );
73 println!("{}", "-".repeat(63));
74
75 for req in requests {
76 let permitted = gov.check_access(req.capability, req.app, req.battery);
77 let correct = permitted == req.expected;
78 println!(
79 "{:<15} {:<15} {:<10} {:<10} {:<8}",
80 req.capability,
81 req.app,
82 format!("{}%", req.battery),
83 if permitted { "YES ✓" } else { "NO ✗" },
84 if correct { "✓" } else { "FAIL" },
85 );
86 }
87
88 println!("\n=== Key properties demonstrated ===");
89 println!(" • Deterministic: same inputs → same output, always");
90 println!(" • Auditability: every decision has a logic trace");
91 println!(" • No inference: pure formal logic, no learned weights");
92 println!(" • Embedded-capable: no heap allocation in access-control path");
93 println!(" • <1µs decision time on ARM Cortex-M4 (est.)");
94 println!("\nThis is the 'BIOS governance chip' concept:");
95 println!(" The same engine governs a medical device AND a healthcare ERP.");
96 println!(" Same paradigms. Same Unicode dictionary. Same audit trail format.");
97 println!(" Different policies. Universal governance layer.");
98}Sourcepub fn evaluate_simple(&self, _capability: SemanticClass, subject: bool) -> bool
pub fn evaluate_simple(&self, _capability: SemanticClass, subject: bool) -> bool
Evaluate a pre-classified governance expression for embedded use.
Returns only the boolean permit/deny — no heap allocation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BiosGovernor
impl RefUnwindSafe for BiosGovernor
impl Send for BiosGovernor
impl Sync for BiosGovernor
impl Unpin for BiosGovernor
impl UnsafeUnpin for BiosGovernor
impl UnwindSafe for BiosGovernor
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