Skip to main content

Builder

Struct Builder 

Source
pub struct Builder<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Builder<'a>

Source

pub const fn with_implicit_iota_imports(self) -> Self

Add iota implicit imports as explicit use statements to the module.

Adapted from the sui equivalents.

Source

pub const fn with_implicit_sui_imports(self) -> Self

Add sui implicit imports as explicit use statements to the module.

This is done after reading the Move files and before generating the Rust code. Without this, datatypes with field types like UID which aren’t explicitly imported in Move modules will fail to compile because they will not have the full path to the Rust equivalent.

Reference

Source

pub fn moverox_path(self, rust_path: &str) -> Self

Path to the module containing the necessary exports that the generated code needs.

Defaults to ::moverox.

rust_path must point to a crate/module which exports:

  • a types module with Address and U256 types from moverox-types
  • a traits module with HasKey, MoveDatatype and MoveType traits from moverox-traits
  • the serde crate
Source

pub fn map_address(self, named_address: &str, rust_path: &str) -> Self

Map a Move named address to the path of an oxidized Move package.

This is necessary for Move code that depends on other packages. The idea is to ‘oxidize’ those dependency packages first and them substitute their paths for the Move paths in the source code this builder is processing.

§Panics

If named_address is not a valid identifier

Source

pub const fn published_at(self, hex_address: &'a str) -> Self

Source

pub const fn emit_rerun_if_changed(self, enable: bool) -> Self

Enable or disable emitting cargo:rerun-if-changed=PATH instructions for Cargo.

If set, writes instructions to stdout for Cargo so that it understands when to rerun the build script. By default, this setting is enabled if the CARGO environment variable is set. The CARGO environment variable is set by Cargo for build scripts. Therefore, this setting should be enabled automatically when run from a build script. However, the method of detection is not completely reliable since the CARGO environment variable can have been set by anything else. If writing the instructions to stdout is undesirable, you can disable this setting explicitly.

Source

pub fn out_dir(self, path: impl Into<PathBuf>) -> Self

Configures the output directory where generated Rust files will be written.

If unset, defaults to the OUT_DIR environment variable. OUT_DIR is set by Cargo when executing build scripts, so out_dir typically does not need to be configured.

Source

pub fn build(self) -> Result<(), Box<dyn StdError + Send + Sync + 'static>>

Auto Trait Implementations§

§

impl<'a> Freeze for Builder<'a>

§

impl<'a> RefUnwindSafe for Builder<'a>

§

impl<'a> !Send for Builder<'a>

§

impl<'a> !Sync for Builder<'a>

§

impl<'a> Unpin for Builder<'a>

§

impl<'a> UnwindSafe for Builder<'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.