pub struct Interface {
pub module: String,
pub types: Vec<TyDecl>,
pub traits: Vec<TraitSig>,
pub impls: Vec<ImplSig>,
pub items: Vec<Item>,
}Expand description
A module’s published signature.
Fields§
§module: String§types: Vec<TyDecl>Types in declaration order, so the rendered file is stable.
traits: Vec<TraitSig>The trait declarations this module owns.
impls: Vec<ImplSig>The impl headers this module owns — the bodies stay behind, and what crosses is that the
implementation exists and what it promises. Without these, a call in an importing module has
a trait and nothing to resolve it to.
items: Vec<Item>Implementations§
Source§impl Interface
impl Interface
pub fn item(&self, name: &str) -> Option<&Item>
Sourcepub fn digest(&self) -> String
pub fn digest(&self) -> String
A content hash of everything a downstream module can depend on.
Deliberately not a hash of the rendered file: a comment, or a change of field order in the printer, must not invalidate a build. It is a hash of the meaning.
Sourcepub fn parse(
module: &str,
src: &str,
map: &mut SourceMap,
diags: &mut Diagnostics,
) -> Interface
pub fn parse( module: &str, src: &str, map: &mut SourceMap, diags: &mut Diagnostics, ) -> Interface
Read a .becki back.
The caller’s SourceMap, for the same reason crate::project gives one to every
module it loads: a diagnostic about orders.becki has to point into orders.becki. A map
made and dropped here would leave every diagnostic carrying a FileId the renderer resolves
against somebody else’s file, which is worse than no span at all — it points confidently at
an unrelated line.