Skip to main content

IdrisBackend

Struct IdrisBackend 

Source
pub struct IdrisBackend {
    pub add_header: bool,
    pub default_total: bool,
    pub auto_implicit: bool,
    pub options: IdrisBackendOptions,
}
Expand description

The Idris 2 code generation backend.

Converts IdrisModule / individual declarations into .idr source text.

Fields§

§add_header: bool

Whether to add -- AUTO-GENERATED header.

§default_total: bool

Whether to emit %default total at the top of each module.

§auto_implicit: bool

Whether to emit %auto_implicit pragmas.

§options: IdrisBackendOptions

Configuration options.

Implementations§

Source§

impl IdrisBackend

Source

pub fn new() -> Self

Create a backend with default settings.

Source

pub fn proof_mode() -> Self

Create a backend optimised for proof-oriented Idris 2 output.

Source

pub fn emit_module(&self, module: &IdrisModule) -> String

Emit a complete IdrisModule as .idr source text.

Source

pub fn emit_decl(&self, decl: &IdrisDecl) -> String

Emit a single declaration.

Source

pub fn emit_function(&self, func: &IdrisFunction) -> String

Emit a single function.

Source

pub fn emit_data(&self, data: &IdrisData) -> String

Emit a single data declaration.

Source

pub fn emit_record(&self, rec: &IdrisRecord) -> String

Emit a single record.

Source

pub fn emit_interface(&self, iface: &IdrisInterface) -> String

Emit a single interface.

Source

pub fn emit_impl(&self, im: &IdrisImpl) -> String

Emit a single implementation.

Trait Implementations§

Source§

impl Debug for IdrisBackend

Source§

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

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

impl Default for IdrisBackend

Source§

fn default() -> IdrisBackend

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

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> 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, 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.