Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MSRV to cargo.toml and README #300

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
ts-rs
</h1>
<p align="center">
generate typescript type declarations from rust types
Generate typescript type declarations from rust types
</p>

<div align="center">
Expand All @@ -26,20 +26,20 @@ alt="Download" />
</a>
</div>

### why?
### Why?
When building a web application in rust, data structures have to be shared between backend and frontend.
Using this library, you can easily generate TypeScript bindings to your rust structs & enums so that you can keep your
types in one place.

ts-rs might also come in handy when working with webassembly.

### how?
### How?
ts-rs exposes a single trait, `TS`. Using a derive macro, you can implement this interface for your types.
Then, you can use this trait to obtain the TypeScript bindings.
We recommend doing this in your tests.
[See the example](https://github.com/Aleph-Alpha/ts-rs/blob/main/example/src/lib.rs) and [the docs](https://docs.rs/ts-rs/latest/ts_rs/).

### get started
### Get started
```toml
[dependencies]
ts-rs = "8.1"
Expand All @@ -58,7 +58,7 @@ struct User {
```
When running `cargo test`, the TypeScript bindings will be exported to the file `bindings/User.ts`.

### features
### Features
- generate type declarations from rust structs
- generate union declarations from rust enums
- inline types
Expand Down Expand Up @@ -92,7 +92,7 @@ When running `cargo test`, the TypeScript bindings will be exported to the file
If there's a type you're dealing with which doesn't implement `TS`, use either
`#[ts(as = "..")]` or `#[ts(type = "..")]`, or open a PR.

### serde compatability
### `serde` compatability
With the `serde-compat` feature (enabled by default), serde attributes can be parsed for enums and structs.
Supported serde attributes:
- `rename`
Expand All @@ -110,17 +110,12 @@ from the generated type, but cannot use `#[serde(skip)]`, use `#[ts(skip)]` inst

When ts-rs encounters an unsupported serde attribute, a warning is emitted, unless the feature `no-serde-warnings` is enabled.

### contributing
### Contributing
Contributions are always welcome!
Feel free to open an issue, discuss using GitHub discussions or open a PR.
[See CONTRIBUTING.md](https://github.com/Aleph-Alpha/ts-rs/blob/main/CONTRIBUTING.md)

### todo
- [x] serde compatibility layer
- [x] documentation
- [x] use typescript types across files
- [x] more enum representations
- [x] generics
- [x] don't require `'static`
### MSRV
The Minimum Supported Rust Version for this crate is 1.75.0

License: MIT
2 changes: 1 addition & 1 deletion macros/src/attr/struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl StructAttr {

let docs = parse_docs(attrs)?;
result.docs = docs;

Ok(result)
}

Expand Down
1 change: 1 addition & 0 deletions ts-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ categories = [
"web-programming",
]
readme = "../README.md"
rust-version = "1.75.0"

[features]
chrono-impl = ["chrono"]
Expand Down
23 changes: 9 additions & 14 deletions ts-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! ts-rs
//! </h1>
//! <p align="center">
//! generate typescript type declarations from rust types
//! Generate typescript type declarations from rust types
//! </p>
//!
//! <div align="center">
Expand All @@ -24,20 +24,20 @@
//! </a>
//! </div>
//!
//! ## why?
//! ## Why?
//! When building a web application in rust, data structures have to be shared between backend and frontend.
//! Using this library, you can easily generate TypeScript bindings to your rust structs & enums so that you can keep your
//! types in one place.
//!
//! ts-rs might also come in handy when working with webassembly.
//!
//! ## how?
//! ## How?
//! ts-rs exposes a single trait, `TS`. Using a derive macro, you can implement this interface for your types.
//! Then, you can use this trait to obtain the TypeScript bindings.
//! We recommend doing this in your tests.
//! [See the example](https://github.com/Aleph-Alpha/ts-rs/blob/main/example/src/lib.rs) and [the docs](https://docs.rs/ts-rs/latest/ts_rs/).
//!
//! ## get started
//! ## Get started
//! ```toml
//! [dependencies]
//! ts-rs = "8.1"
Expand All @@ -56,7 +56,7 @@
//! ```
//! When running `cargo test`, the TypeScript bindings will be exported to the file `bindings/User.ts`.
//!
//! ## features
//! ## Features
//! - generate type declarations from rust structs
//! - generate union declarations from rust enums
//! - inline types
Expand Down Expand Up @@ -90,7 +90,7 @@
//! If there's a type you're dealing with which doesn't implement `TS`, use either
//! `#[ts(as = "..")]` or `#[ts(type = "..")]`, or open a PR.
//!
//! ## serde compatability
//! ## `serde` compatability
//! With the `serde-compat` feature (enabled by default), serde attributes can be parsed for enums and structs.
//! Supported serde attributes:
//! - `rename`
Expand All @@ -108,18 +108,13 @@
//!
//! When ts-rs encounters an unsupported serde attribute, a warning is emitted, unless the feature `no-serde-warnings` is enabled.
//!
//! ## contributing
//! ## Contributing
//! Contributions are always welcome!
//! Feel free to open an issue, discuss using GitHub discussions or open a PR.
//! [See CONTRIBUTING.md](https://github.com/Aleph-Alpha/ts-rs/blob/main/CONTRIBUTING.md)
//!
//! ## todo
//! - [x] serde compatibility layer
//! - [x] documentation
//! - [x] use typescript types across files
//! - [x] more enum representations
//! - [x] generics
//! - [x] don't require `'static`
//! ## MSRV
//! The Minimum Supported Rust Version for this crate is 1.75.0

use std::{
any::TypeId,
Expand Down
Loading