#[non_exhaustive]pub struct Typescript {
pub header: Cow<'static, str>,
pub framework_header: Cow<'static, str>,
pub bigint: BigIntExportBehavior,
pub comment_exporter: Option<fn(CommentFormatterArgs<'_>) -> String>,
pub formatter: Option<fn(&Path) -> Result<(), Error>>,
}
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 users file header
framework_header: Cow<'static, str>
The framework’s header
bigint: BigIntExportBehavior
How BigInts should be exported.
comment_exporter: Option<fn(CommentFormatterArgs<'_>) -> String>
How comments should be rendered.
formatter: Option<fn(&Path) -> Result<(), Error>>
How the resulting file should be formatted.
Implementations§
Source§impl Typescript
impl Typescript
Sourcepub fn new() -> Typescript
pub fn new() -> Typescript
Construct a new Typescript exporter with the default options configured.
Sourcepub fn header(self, header: impl Into<Cow<'static, str>>) -> Typescript
pub fn header(self, header: impl Into<Cow<'static, str>>) -> Typescript
Configure a header for the file.
This is perfect for configuring lint ignore rules or other file-level comments.
Sourcepub fn bigint(self, bigint: BigIntExportBehavior) -> Typescript
pub fn bigint(self, bigint: BigIntExportBehavior) -> Typescript
Configure the BigInt handling behaviour
Sourcepub fn comment_style(
self,
exporter: fn(CommentFormatterArgs<'_>) -> String,
) -> Typescript
pub fn comment_style( self, exporter: fn(CommentFormatterArgs<'_>) -> String, ) -> Typescript
Sourcepub fn export(&self, types: &TypeCollection) -> Result<String, ExportError>
pub fn export(&self, types: &TypeCollection) -> Result<String, ExportError>
TODO
Sourcepub fn export_to(
&self,
path: impl AsRef<Path>,
types: &TypeCollection,
) -> Result<(), ExportError>
pub fn export_to( &self, path: impl AsRef<Path>, types: &TypeCollection, ) -> Result<(), ExportError>
TODO
Trait Implementations§
Source§impl Clone for Typescript
impl Clone for Typescript
Source§fn clone(&self) -> Typescript
fn clone(&self) -> Typescript
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Typescript
impl Debug for Typescript
Source§impl Default for Typescript
impl Default for Typescript
Source§fn default() -> Typescript
fn default() -> Typescript
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for Typescript
impl RefUnwindSafe for Typescript
impl Send for Typescript
impl Sync for Typescript
impl Unpin for Typescript
impl UnwindSafe for Typescript
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more