pub struct ImplTraitBoundary { /* private fields */ }Expand description
An impl-trait boundary: a module’s public API must not return a written impl Trait
(return-position impl Trait / RPIT). The existential complement of DynTraitBoundary:
where that forbids the dynamic-dispatch shape (dyn), this forbids the existential shape —
an unnameable type the caller cannot name, store without boxing, or rely on beyond its declared
bounds. Governs return positions only: argument-position impl Trait (APIT) is universal
(a caller-chosen generic), not an existential leak, and is never governed; async fn’s implicit
impl Future is a distinct compiler-inserted existential, out of scope. Declared in Rust and
composed with the other dimensions at the gate.
Two depths on one boundary type, selected by the builder (mirroring DynTraitBoundary):
must_not_expose_impl_trait— shape-only: an empty operand set, so any returnedimpl Traitreacts.must_not_expose_impl_trait_of— operand-scoped: only a returnedimpl Traitwhose principal trait resolves into the namedforbidden_operandsset reacts.
Implementations§
Source§impl ImplTraitBoundary
impl ImplTraitBoundary
Sourcepub fn in_crate(package: &str) -> ImplTraitCrateDraft
pub fn in_crate(package: &str) -> ImplTraitCrateDraft
Begin an impl-trait boundary in the crate named package.
Sourcepub fn crate_package(&self) -> &str
pub fn crate_package(&self) -> &str
The crate this boundary governs.
Sourcepub fn forbidden_operands(&self) -> &[String]
pub fn forbidden_operands(&self) -> &[String]
The forbidden trait operands. Empty ⇒ shape-only (any returned impl Trait reacts); a named
set ⇒ only a returned impl Trait whose principal trait resolves into the set reacts.
Sourcepub fn reason(&self) -> &str
pub fn reason(&self) -> &str
The human-readable reason recorded with the boundary (the repair hint).
Sourcepub fn with_anchor(self, anchor: &str) -> Self
pub fn with_anchor(self, anchor: &str) -> Self
Attach a durable governance anchor (e.g. "ADR-014") — a stable pointer into the
project’s governance, distinct from the free-text reason. Optional; a boundary with
none projects and reacts exactly as before.
Trait Implementations§
Source§impl Clone for ImplTraitBoundary
impl Clone for ImplTraitBoundary
Source§fn clone(&self) -> ImplTraitBoundary
fn clone(&self) -> ImplTraitBoundary
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more