⬡
Ferrous Bridge
Papers
GitHub
☰ Contents
Contents
1.1 What “safe and idiomatic” means in this paper
1.2 safe-libyaml as the running example
1.3 Outline
2.1 Lifetimes as regions
2.2 The borrow judgment
2.3 The Result and Option algebra
3.1 The single-owner buffer
3.2 The zero-copy &[u8] pattern
4.1 The lifetime-parameterised Event<′a>
4.2 Escape hatches: OwnedEvent and the borrow-vs-clone tradeoff
5.1 Library vs. application errors
5.2 Why we do not chain via Error::source()
5.3 The Result<Event<′a>, Error> shape
6.1 The libyaml macro family
6.2 Capacity-doubling proposition
6.3 When Cow earns its keep
6.4 The BString alternative and the UTF-8 default
7.1 What changes when shipping for embedded
7.2 The core::ffi story
7.3 Feature flags
8.1 The discriminant
8.2 The #[non_exhaustive] discipline
9.1 Discipline
9.2 The safe-libyaml-sys split
9.3 Interior unsafety as an anti-pattern
10.1 The drop-in replacement principle
10.2 #[repr(C)] layout
10.3 The cbindgen contract
10.4 Symbol-level enumeration
10.5 Bridging C FILE* to Rust Read
10.6 Why serde_yaml_ng matters
14.1 Performance: targets, not measurements
14.2 Limitations
14.3 Place in the broader project (optional reading)
16.1 The exact public API the agents must target
16.1.1 safe-libyaml::Parser
16.1.2 safe-libyaml::Event
16.1.3 safe-libyaml::Emitter
16.1.4 safe-libyaml-sys::extern "C" symbols
16.2 Workspace layout (target)
16.3 Agent task list
16.3.1 Agent A2 — Scaffold Builder
16.3.2 Agent OSG-to-Rust emitter
16.3.3 Agent C4 — Idiom Polisher
16.3.4 Crate-layout agent (umbrella)
16.4 Module dependency diagram
16.5 Reference lints.toml
16.6 Hand-off to Phase B
Part II
Idiomatic Safe Rust as a Translation Target: Ownership, Lifetimes, and ABI-Compatible Parser Design
37 pages
cs.PL
DOI: 2026.04.rust
← Previous
The C Language as a Translation Source: Semantics, Undefined Behavior, and the libyaml Idiom Set
Next →
Automated C → Rust Transpiling: From c2rust's Raw Lift to Safe, Idiomatic Rust via the Safety Ladder
⤓ PDF