Struct ClientGenerator

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

Implementations§

Source§

impl<'a, S> ClientGenerator<'a, S>

Source

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

Source

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

Source

pub fn with_external_type(self, name: &'a str, path: &'a 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::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 and [scale_info::TypeInfo] traits for the generated types

By default, types additionally derive PartialEq, Clone and Debug

Source§

impl<'a> ClientGenerator<'a, IdlPath<'a>>

Source

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

Source

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

Source§

impl<'a> ClientGenerator<'a, IdlString<'a>>

Source

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

Source

pub fn generate(self, anonymous_service_name: &str) -> Result<String>

Source

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

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<'a, S> UnwindSafe for ClientGenerator<'a, 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.