CodeBuilder

Struct CodeBuilder 

Source
pub struct CodeBuilder<'a> { /* private fields */ }
Expand description

Code Generator

Generate code based on the constructed Map and the provided sequence.

Implementations§

Source§

impl<'a> CodeBuilder<'a>

Source

pub fn new( name: String, hash: String, u8seq_writer: &'a mut U8SeqWriter, u32seq_writer: &'a mut U32SeqWriter, ) -> CodeBuilder<'a>

Specifies the name, hash, and directory to use for the output map code.

Note that hash must be a fully qualified type path that implements the HashOne trait and is consistent with the algorithm used by MapBuilder.

Source

pub fn set_visibility(&mut self, vis: Option<String>)

This will configure the generated code as pub(vis).

Source

pub fn create_custom(&mut self, name: String) -> ReferenceId

Source

pub fn create_keys<SEQ, T>( &mut self, name: String, item_type: String, mapout: &MapOutput, seq: SEQ, ) -> Result<ReferenceId>
where SEQ: Iterator<Item = T> + ExactSizeIterator, T: Display,

Source

pub fn create_list<SEQ, T>( &mut self, name: String, item_type: String, seq: SEQ, ) -> Result<ReferenceId>
where SEQ: Iterator<Item = T> + ExactSizeIterator, T: Display,

Source

pub fn create_pair( &mut self, keys: ReferenceId, values: ReferenceId, ) -> ReferenceId

Source

pub fn create_bytes_keys<SEQ, B>( &mut self, name: String, mapout: &MapOutput, seq: SEQ, ) -> Result<ReferenceId>
where SEQ: Iterator<Item = B> + ExactSizeIterator, B: AsRef<[u8]>,

Source

pub fn create_bytes_position_seq<SEQ, B>( &mut self, name: String, seq: SEQ, ) -> Result<ReferenceId>
where SEQ: Iterator<Item = B> + ExactSizeIterator, B: AsRef<[u8]>,

Source

pub fn create_u32_seq<SEQ>( &mut self, name: String, seq: SEQ, ) -> Result<ReferenceId>
where SEQ: Iterator<Item = u32> + ExactSizeIterator,

Source

pub fn create_short_id_seq<SEQ>( &mut self, name: String, pool: &ShortPool<'_>, seq: SEQ, ) -> Result<ReferenceId>
where SEQ: Iterator<Item = ShortId> + ExactSizeIterator,

Source

pub fn codegen(self, writer: &mut dyn Write) -> Result<()>

Auto Trait Implementations§

§

impl<'a> Freeze for CodeBuilder<'a>

§

impl<'a> RefUnwindSafe for CodeBuilder<'a>

§

impl<'a> Send for CodeBuilder<'a>

§

impl<'a> Sync for CodeBuilder<'a>

§

impl<'a> Unpin for CodeBuilder<'a>

§

impl<'a> !UnwindSafe for CodeBuilder<'a>

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.