Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jiangjie/happy-rusty
Porting some excellent design implementations from Rust to JavaScript.
https://github.com/jiangjie/happy-rusty
err none ok option result rust some
Last synced: 6 days ago
JSON representation
Porting some excellent design implementations from Rust to JavaScript.
- Host: GitHub
- URL: https://github.com/jiangjie/happy-rusty
- Owner: JiangJie
- License: gpl-3.0
- Created: 2024-04-24T12:47:26.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-05-22T15:59:39.000Z (6 months ago)
- Last Synced: 2024-05-22T16:47:12.931Z (6 months ago)
- Topics: err, none, ok, option, result, rust, some
- Language: TypeScript
- Homepage:
- Size: 217 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.cn.md
- License: LICENSE
Awesome Lists containing this project
README
# 在 JavaScript 中使用 Rust 特性
[![NPM version](https://img.shields.io/npm/v/happy-rusty.svg)](https://npmjs.org/package/happy-rusty)
[![NPM downloads](https://badgen.net/npm/dm/happy-rusty)](https://npmjs.org/package/happy-rusty)
[![JSR Version](https://jsr.io/badges/@happy-js/happy-rusty)](https://jsr.io/@happy-js/happy-rusty)
[![JSR Score](https://jsr.io/badges/@happy-js/happy-rusty/score)](https://jsr.io/@happy-js/happy-rusty/score)
[![Build Status](https://github.com/jiangjie/happy-rusty/actions/workflows/test.yml/badge.svg)](https://github.com/jiangjie/happy-rusty/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/JiangJie/happy-rusty/graph/badge.svg)](https://codecov.io/gh/JiangJie/happy-rusty)---
## 支持的特性
- [Option](https://doc.rust-lang.org/core/option/index.html)
- [Result](https://doc.rust-lang.org/core/result/index.html)## 安装
```sh
# via pnpm
pnpm add happy-rusty
# or via yarn
yarn add happy-rusty
# or just from npm
npm install --save happy-rusty
# via JSR
jsr add @happy-js/happy-rusty
# for deno
deno add @happy-js/happy-rusty
# for bun
bunx jsr add @happy-js/happy-rusty
```接下来就可以在代码里引用了。
```ts
import { Some, None, Ok, Err } from 'happy-rusty';
```## [示例](examples/main.ts)
- [Option](examples/option.ts)
- [AsyncOption](examples/option.async.ts)
- [Result](examples/result.ts)
- [AsyncResult](examples/result.async.ts)## [文档](docs/README.md)