Struct specta_typescript::Typescript

source ·
#[non_exhaustive]
pub struct Typescript { pub header: Cow<'static, str>, pub remove_default_header: bool, pub bigint: BigIntExportBehavior, pub comment_exporter: Option<CommentFormatterFn>, pub formatter: Option<FormatterFn>, }
Expand description

Typescript language exporter.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§header: Cow<'static, str>

The file’s header

§remove_default_header: bool

Should we remove the default header?

§bigint: BigIntExportBehavior

How BigInts should be exported.

§comment_exporter: Option<CommentFormatterFn>

How comments should be rendered.

§formatter: Option<FormatterFn>

How the resulting file should be formatted.

Implementations§

source§

impl Typescript

source

pub fn new() -> Self

Construct a new Typescript exporter with the default options configured.

source

pub fn header(self, header: impl Into<Cow<'static, str>>) -> Self

Configure a header for the file.

This is perfect for configuring lint ignore rules or other file-level comments.

source

pub fn remove_default_header(self) -> Self

Removes the default Specta header from the output.

source

pub fn bigint(self, bigint: BigIntExportBehavior) -> Self

Configure the BigInt handling behaviour

source

pub fn comment_style(self, exporter: CommentFormatterFn) -> Self

Configure a function which is responsible for styling the comments to be exported

Implementations:

Not calling this method will default to the js_doc exporter. None will disable comment exporting. Some(exporter) will enable comment exporting using the provided exporter.

source

pub fn formatter(self, formatter: FormatterFn) -> Self

Configure a function which is responsible for formatting the result file or files

Built-in implementations:

Trait Implementations§

source§

impl Clone for Typescript

source§

fn clone(&self) -> Typescript

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Typescript

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Typescript

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Language for Typescript

§

type Error = ExportError

TODO
source§

fn export(&self, type_map: TypeMap) -> Result<String, Self::Error>

TODO
source§

fn format(&self, path: &Path) -> Result<(), Self::Error>

TODO

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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.