refactor: compress pass over sealed wasi, alloc, http, session, agent
10387faaaa9b17f4222a566a55ae8f9f0ccf3125
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
- Parent 1: 0b0de9c6beb6
There are many coding harnesses - but this one is fast
10387faaaa9b17f4222a566a55ae8f9f0ccf3125
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
+96 / −134 text lines
+18 / −13 text lines
let base = raw(outer); // SAFETY: `raw` returned null or a block of `outer`. unsafe { Self::stamp(raw(outer), pad, layout.size()) } } /// Tag a fresh `System` block with the current scope and charge `size` /// to it; null passes through. /// /// # Safety /// `base` is null or a block spanning `pad + size` bytes, `pad >= 1`. unsafe fn stamp(base: *mut u8, pad: usize, size: usize) -> *mut u8 { // SAFETY: as `dealloc`; on success `System` moved the header with the data.+6 / −14 text lines
return Err(bounded("request body exceeds the size bound"));fn transport_fault(message: &str) -> SmithError {const fn transient(message: String) -> SmithError {+3 / −2 text lines
let ceilings = PluginCeilings::default();+69 / −105 text lines
for denied in rule.denied {/// Library edges a crate may have; every other workspace crate is denied.const fn dependency_rules() -> &'static [DependencyRule] { &[ DependencyRule { crate_name: "smith", denied: &[ "smith-core", "smith-ai", "smith-ui", "smith-tui", "smith-harness", "smith-cli", "smith-alloc", ], }, DependencyRule { crate_name: "smith-core", denied: &[ "smith-ai", "smith-ui", "smith-tui", "smith-harness", "smith-cli", "smith-alloc", ], }, DependencyRule { crate_name: "smith-ai", denied: &[ "smith-core", "smith-ui", "smith-tui", "smith-harness", "smith-cli", "smith-alloc", ], }, DependencyRule { crate_name: "smith-ui", denied: &[ "smith-core", "smith-ai", "smith-tui", "smith-harness", "smith-cli", "smith-alloc", ], }, DependencyRule { crate_name: "smith-tui", denied: &[ "smith-core", "smith-ai", "smith-harness", "smith-cli", "smith-alloc", ], }, DependencyRule { crate_name: "smith-rpc", denied: &[ "smith-ai", "smith-ui", "smith-tui", "smith-harness", "smith-cli", "smith-alloc", ], }, DependencyRule { crate_name: "smith-cli", denied: &["smith-core", "smith-ai", "smith-ui", "smith-tui"], }, DependencyRule { crate_name: "xtask", denied: &[ "smith", "smith-core", "smith-ai", "smith-ui", "smith-tui", "smith-harness", "smith-cli", "smith-alloc", ], }, DependencyRule { crate_name: "smith-alloc", denied: &[ "smith", "smith-core", "smith-ai", "smith-ui", "smith-tui", "smith-rpc", "smith-harness", "smith-cli", "xtask", ], }, ]}/// The allowed-deps table of `.system/RULES.md`, architecture section.const DEPENDENCY_RULES: &[DependencyRule] = &[ DependencyRule { crate_name: "smith", allowed: &[], }, DependencyRule { crate_name: "smith-ui", allowed: &["smith"], }, DependencyRule { crate_name: "smith-core", allowed: &["smith"], }, DependencyRule { crate_name: "smith-ai", allowed: &["smith"], }, DependencyRule { crate_name: "smith-tui", allowed: &["smith", "smith-ui"], }, DependencyRule { crate_name: "smith-rpc", allowed: &["smith", "smith-core"], }, DependencyRule { crate_name: "smith-harness", allowed: &["smith", "smith-core", "smith-ai", "smith-tui", "smith-ui"], }, DependencyRule { crate_name: "smith-cli", allowed: &["smith", "smith-harness", "smith-rpc", "smith-alloc"], }, DependencyRule { crate_name: "smith-alloc", allowed: &[], }, DependencyRule { crate_name: "xtask", allowed: &[], },]; use super::{binary_name, dev_home_dirs, has_dependency, target_dir}; use super::{CRATES, DEPENDENCY_RULES, binary_name, dev_home_dirs, has_dependency, target_dir}; #[test] fn every_crate_has_one_rule_over_known_crates() { for name in CRATES { let rules = DEPENDENCY_RULES .iter() .filter(|rule| rule.crate_name == *name); assert_eq!(rules.count(), 1, "{name}"); } assert_eq!(DEPENDENCY_RULES.len(), CRATES.len()); for rule in DEPENDENCY_RULES { assert!( rule.allowed .iter() .all(|dep| CRATES.contains(dep) && *dep != rule.crate_name) ); } }