Skip to main content

ClientGenerator

Struct ClientGenerator 

Source
pub struct ClientGenerator<'ast, S> { /* private fields */ }

Implementations§

Source§

impl<'ast, S> ClientGenerator<'ast, S>

Source

pub fn with_mocks(self, mocks_feature_name: &'ast str) -> Self

Source

pub fn with_sails_crate(self, sails_path: &'ast str) -> Self

Source

pub fn with_no_std(self, with_no_std: bool) -> Self

Source

pub fn with_external_type(self, name: &'ast str, path: &'ast str) -> Self

Add an map from IDL type to crate path

Instead of generating type in client code, use type path from external crate

§Example

Following code generates use my_crate::MyParam as MyFuncParam;

let code = sails_client_gen_v2::ClientGenerator::from_idl("<idl>")
    .with_external_type("MyFuncParam", "my_crate::MyParam");
Source

pub fn with_no_derive_traits(self) -> Self

Derive only nessessary parity_scale_codec::Encode, parity_scale_codec::Decode, [type_info::TypeInfo] and [sails_reflect_hash::ReflectHash] traits for the generated types

By default, types additionally derive PartialEq, Clone and Debug

Source

pub fn with_client_path(self, client_path: &'ast Path) -> Self

Source§

impl<'ast> ClientGenerator<'ast, IdlPath<'ast>>

Source

pub fn from_idl_path(idl_path: &'ast Path) -> Self

Source

pub fn generate(self) -> Result<()>

Source

pub fn generate_to(self, out_path: impl AsRef<Path>) -> Result<()>

Source§

impl<'ast> ClientGenerator<'ast, IdlString<'ast>>

Source

pub fn from_idl(idl: &'ast str) -> Self

Source

pub fn generate(self) -> Result<String>

Source

pub fn generate_to(self, out_path: impl AsRef<Path>) -> Result<()>

Auto Trait Implementations§

§

impl<'ast, S> Freeze for ClientGenerator<'ast, S>
where S: Freeze,

§

impl<'ast, S> RefUnwindSafe for ClientGenerator<'ast, S>
where S: RefUnwindSafe,

§

impl<'ast, S> Send for ClientGenerator<'ast, S>
where S: Send,

§

impl<'ast, S> Sync for ClientGenerator<'ast, S>
where S: Sync,

§

impl<'ast, S> Unpin for ClientGenerator<'ast, S>
where S: Unpin,

§

impl<'ast, S> UnsafeUnpin for ClientGenerator<'ast, S>
where S: UnsafeUnpin,

§

impl<'ast, S> UnwindSafe for ClientGenerator<'ast, S>
where S: UnwindSafe,

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.