Interface

Struct Interface 

Source
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

Source

pub fn of(program: &Program) -> Interface

Extract the interface of a checked, placed program.

Source

pub fn item(&self, name: &str) -> Option<&Item>

Source

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.

Source

pub fn render(&self) -> String

Render the .becki file.

Source

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.

Source

pub fn exports( &self, ) -> (BTreeMap<Arc<str>, TyDecl>, BTreeMap<Arc<str>, Export>)

Register this interface’s types and names in a checker’s environment.

Trait Implementations§

Source§

impl Clone for Interface

Source§

fn clone(&self) -> Interface

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Interface

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Interface

Source§

fn default() -> Interface

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Interface

Source§

fn eq(&self, other: &Interface) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Interface

Source§

impl StructuralPartialEq for Interface

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.