Skip to main content

EmitState

Struct EmitState 

Source
pub struct EmitState<'p> {
    pub program: &'p Program,
    pub language: Language,
    pub ident: fn(&str) -> String,
    pub mappings: Vec<Mapping>,
    pub theorems: Vec<TheoremRecord>,
    /* private fields */
}

Fields§

§program: &'p Program§language: Language§ident: fn(&str) -> String§mappings: Vec<Mapping>§theorems: Vec<TheoremRecord>

Implementations§

Source§

impl<'p> EmitState<'p>

Source

pub fn new( program: &'p Program, language: Language, ident: fn(&str) -> String, reserved: &[&str], options: EmitOptions, ) -> Self

Source

pub fn local_reserved(&self) -> BTreeSet<String>

Names a local binder may not take: a local named like a module, a top-level function or a constructor would shadow it in the target.

Source

pub fn local_name(&self, full_name: &str) -> &str

The target name of a declaration within its module.

§Panics

When full_name is not a declaration of the program.

Source

pub fn module_path(&self, full_name: &str) -> &[String]

The target module path of a declaration.

§Panics

When full_name is not a declaration of the program.

Source

pub fn module_name(&self, source_path: &[String]) -> Option<&str>

The target name of a source module.

Source

pub fn reference(&self, full_name: &str, separator: &str) -> String

Fully qualified reference from the top level.

Source

pub fn ctor_local(&self, data_name: &str, ctor: &str) -> &str

The target name of a constructor within its namespace.

§Panics

When the constructor is not declared.

Source

pub fn ctor_ref(&self, data_name: &str, ctor: &str, separator: &str) -> String

Fully qualified constructor reference from the top level.

Source

pub fn map(&mut self, entry: &Decl, target: &str)

Records where a declaration (and a data type’s constructors) went.

Source

pub fn assume(&mut self, assumption: AssumptionText, detail: Option<&str>)

Source

pub fn machine_integer(&mut self, ty: &Type, representation: &str)

A machine integer of a pure target: its unbounded representation, with Rust’s aborts threaded as values (output).

Source

pub fn array_read(&mut self)

An array read: in bounds it is the element, outside it JavaScript’s undefined, which the targets do not model.

Source

pub fn encode(&mut self, id: &str, statement: &str)

Source

pub fn theorem( &mut self, full_name: &str, name: &str, closed_goal: bool, bounded: bool, )

Records a theorem; bounded theorems are checked by the source kernel and tested on bounded inputs in the target.

Source

pub fn assertion_theorem(&mut self, name: &str, effect: &Effect)

Source

pub fn assertion_theorem_with( &mut self, name: &str, effect: &Effect, discharge: Option<&str>, )

An assertion with how it is discharged, such as runtime-assertion.

Source

pub fn assumption_list(&self) -> Vec<Assumption>

Source

pub fn encoding_list(&self) -> Vec<Encoding>

Source

pub fn finish(&self, text: String, entry: Option<String>) -> Emitted

The emitted result with this state’s contract.

Auto Trait Implementations§

§

impl<'p> Freeze for EmitState<'p>

§

impl<'p> RefUnwindSafe for EmitState<'p>

§

impl<'p> Send for EmitState<'p>

§

impl<'p> Sync for EmitState<'p>

§

impl<'p> Unpin for EmitState<'p>

§

impl<'p> UnsafeUnpin for EmitState<'p>

§

impl<'p> UnwindSafe for EmitState<'p>

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
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.