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- [ Rust] abstractions for [ TL;DR] summarization.
8+ [ Rust] abstractions for [ TL;DR] summarization using the [ five Ws ] .
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.
12+ - Provides the [ ` Tldr ` ] trait for generating TL;DR summaries.
13+ - Provides the [ ` ToTldr ` ] trait for converting objects into TL;DR summaries.
1414- Supports TL;DR generation for multiple natural languages.
1515- Zero required dependencies, only optional integrations.
1616- Adheres to the Rust API Guidelines in its [ naming conventions] .
@@ -50,11 +50,30 @@ tldr = { version = "0", package = "tldr-traits", default-features = false, featu
5050use tldr :: * ;
5151```
5252
53+ ### TBD
54+
55+ ``` rust
56+ use tldr_traits :: {Tldr , TldrContext };
57+
58+ struct Rectangle {
59+ width : u32 ,
60+ height : u32 ,
61+ }
62+
63+ impl Tldr for Rectangle {
64+ fn what (& self , _ctx : & TldrContext ) -> Option <String > {
65+ Some (format! (" A rectangle with a width of {} and a height of {}." , self . width, self . height))
66+ }
67+ }
68+ ```
69+
5370## 📚 Reference
5471
5572### [ ` ToTldr ` ]
5673
5774``` rust
75+ use tldr_traits :: Tldr ;
76+
5877pub trait ToTldr {
5978 fn to_tldr (& self ) -> Box <dyn Tldr >;
6079}
@@ -63,6 +82,8 @@ pub trait ToTldr {
6382### [ ` Tldr ` ]
6483
6584``` rust
85+ use tldr_traits :: TldrContext ;
86+
6687pub trait Tldr {
6788 fn who (& self , ctx : & TldrContext ) -> Option <String >;
6889 fn what (& self , ctx : & TldrContext ) -> Option <String >;
@@ -112,9 +133,10 @@ git clone https://github.com/dryrust/tldr.rs.git
112133
113134[ Rust ] : https://rust-lang.org
114135[ TL;DR ] : https://en.wikipedia.org/wiki/TL;DR
136+ [ five Ws ] : https://en.wikipedia.org/wiki/Five_Ws
115137[ naming conventions ] : https://rust-lang.github.io/api-guidelines/naming.html
116138
117- [ `Tldr` ] : #
118- [ `TldrContext` ] : #
119- [ `TldrSummary` ] : #
120- [ `ToTldr` ] : #
139+ [ `Tldr` ] : https://docs.rs/tldr-traits/latest/tldr_traits/trait.Tldr.html
140+ [ `TldrContext` ] : https://docs.rs/tldr-traits/latest/tldr_traits/struct.TldrContext.html
141+ [ `TldrSummary` ] : https://docs.rs/tldr-traits/latest/tldr_traits/struct.TldrSummary.html
142+ [ `ToTldr` ] : https://docs.rs/tldr-traits/latest/tldr_traits/trait.ToTldr.html
0 commit comments