Skip to main content

IdentityMapper

Struct IdentityMapper 

Source
pub struct IdentityMapper;
Expand description

Identity mapper — all type names pass through unchanged. Used as the default mapper when no backend-specific renaming is required.

Trait Implementations§

Source§

impl TypeMapper for IdentityMapper

Source§

fn error_wrapper(&self) -> &str

The error wrapper type for this language. e.g. “PyResult”, “napi::Result”, “PhpResult”
Source§

fn primitive(&self, prim: &PrimitiveType) -> Cow<'static, str>

Map a primitive type. Default: Rust type names.
Source§

fn string(&self) -> Cow<'static, str>

Map a string type. Default: “String”
Source§

fn bytes(&self) -> Cow<'static, str>

Map a bytes type. Default: “Vec
Source§

fn path(&self) -> Cow<'static, str>

Map a path type. Default: “String”
Source§

fn json(&self) -> Cow<'static, str>

Map a JSON type. Default: “serde_json::Value”
Source§

fn unit(&self) -> Cow<'static, str>

Map a unit type. Default: “()”
Source§

fn duration(&self) -> Cow<'static, str>

Map a duration type. Default: “u64” (seconds)
Source§

fn optional(&self, inner: &str) -> String

Map an optional type. Default: “Option
Source§

fn vec(&self, inner: &str) -> String

Map a vec type. Default: “Vec
Source§

fn map(&self, key: &str, value: &str) -> String

Map a map type. Default: “HashMap<K, V>”
Source§

fn named<'a>(&self, name: &'a str) -> Cow<'a, str>

Map a named type. Default: identity.
Source§

fn map_type(&self, ty: &TypeRef) -> String

Map a full TypeRef. Typically not overridden.
Source§

fn wrap_return(&self, base: &str, has_error: bool) -> String

Wrap a return type with error handling if needed.

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.