55[ ![ Package] ( https://img.shields.io/crates/v/tldr-traits )] ( https://crates.io/crates/tldr-traits )
66[ ![ Documentation] ( https://docs.rs/tldr-traits/badge.svg )] ( https://docs.rs/tldr-traits )
77
8- 🚧 _ We are building in public. This is presently under heavy construction. _
8+ [ Rust ] abstractions for [ TL;DR ] summarization.
99
1010## ✨ Features
1111
12+ - Provides the trait [ ` Tldr ` ] to generate TL;DR summaries.
13+ - Provides the trait [ ` ToTldr ` ] to convert objects into TL;DR summaries.
14+ - Supports TL;DR generation for multiple natural languages.
15+ - Zero required dependencies, only optional integrations.
1216- Adheres to the Rust API Guidelines in its [ naming conventions] .
1317- 100% free and unencumbered public domain software.
1418
1519## 🛠️ Prerequisites
1620
17- - [ Rust] ( https://rust-lang.org ) 1.85+ (2024 edition)
21+ - [ Rust] 1.85+ (2024 edition)
1822
1923## ⬇️ Installation
2024
2428cargo add tldr-traits --rename tldr
2529```
2630
31+ ### Installation in ` Cargo.toml ` (with all features enabled)
32+
33+ ``` toml
34+ [dependencies ]
35+ tldr = { version = " 0" , package = " tldr-traits" }
36+ ```
37+
38+ ### Installation in ` Cargo.toml ` (with only specific features enabled)
39+
40+ ``` toml
41+ [dependencies ]
42+ tldr = { version = " 0" , package = " tldr-traits" , default-features = false , features = [" serde" ] }
43+ ```
44+
2745## 👉 Examples
2846
2947### Importing the Library
@@ -32,6 +50,52 @@ cargo add tldr-traits --rename tldr
3250use tldr :: * ;
3351```
3452
53+ ## 📚 Reference
54+
55+ ### [ ` ToTldr ` ]
56+
57+ ``` rust
58+ pub trait ToTldr {
59+ fn to_tldr (& self ) -> Box <dyn Tldr >;
60+ }
61+ ```
62+
63+ ### [ ` Tldr ` ]
64+
65+ ``` rust
66+ pub trait Tldr {
67+ fn who (& self , ctx : & TldrContext ) -> Option <String >;
68+ fn what (& self , ctx : & TldrContext ) -> Option <String >;
69+ fn when (& self , ctx : & TldrContext ) -> Option <String >;
70+ fn r#where (& self , ctx : & TldrContext ) -> Option <String >;
71+ fn why (& self , ctx : & TldrContext ) -> Option <String >;
72+ fn whence (& self , ctx : & TldrContext ) -> Option <String >;
73+ fn how (& self , ctx : & TldrContext ) -> Option <String >;
74+ }
75+ ```
76+
77+ ### [ ` TldrSummary ` ]
78+
79+ ``` rust
80+ pub struct TldrSummary {
81+ pub who : Option <String >,
82+ pub what : Option <String >,
83+ pub when : Option <String >,
84+ pub r#where : Option <String >,
85+ pub why : Option <String >,
86+ pub whence : Option <String >,
87+ pub how : Option <String >,
88+ }
89+ ```
90+
91+ ### [ ` TldrContext ` ]
92+
93+ ``` rust
94+ pub struct TldrContext {
95+ pub language : String ,
96+ }
97+ ```
98+
3599## 👨💻 Development
36100
37101``` bash
@@ -46,4 +110,11 @@ git clone https://github.com/dryrust/tldr.rs.git
46110[ ![ Share on Facebook] ( https://img.shields.io/badge/share%20on-fb-1976D2?logo=facebook )] ( https://www.facebook.com/sharer/sharer.php?u=https://github.com/dryrust/tldr.rs )
47111[ ![ Share on LinkedIn] ( https://img.shields.io/badge/share%20on-linkedin-3949AB?logo=linkedin )] ( https://www.linkedin.com/sharing/share-offsite/?url=https://github.com/dryrust/tldr.rs )
48112
113+ [ Rust ] : https://rust-lang.org
114+ [ TL;DR ] : https://en.wikipedia.org/wiki/TL;DR
49115[ naming conventions ] : https://rust-lang.github.io/api-guidelines/naming.html
116+
117+ [ `Tldr` ] : #
118+ [ `TldrContext` ] : #
119+ [ `TldrSummary` ] : #
120+ [ `ToTldr` ] : #
0 commit comments