Mikhail Kilin
|
67739583f3
|
refactor: generalize LruCache to support any key type (P5.16)
Made LruCache generic over key type K, not just UserId:
- LruCache<V> → LruCache<K, V>
- Added trait bounds: K: Eq + Hash + Clone + Copy
- Updated UserCache field types:
* user_usernames: LruCache<UserId, String>
* user_names: LruCache<UserId, String>
* user_statuses: LruCache<UserId, UserOnlineStatus>
Benefits:
- Reusable cache implementation for any key types
- Type-safe caching
- No additional dependencies
Progress: Priority 5: 2/3 tasks, Total: 18/20 (90%)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2026-02-01 02:26:03 +03:00 |
|
Mikhail Kilin
|
93e43a59d0
|
docs: complete rustdoc documentation for all public APIs (P4.12)
Added comprehensive rustdoc documentation for all TDLib modules,
configuration, and utility functions.
TDLib modules documented:
- src/tdlib/auth.rs - AuthManager, AuthState (6 doctests)
- src/tdlib/chats.rs - ChatManager (8 doctests)
- src/tdlib/messages.rs - MessageManager (14 methods, 6 doctests)
- src/tdlib/reactions.rs - ReactionManager (3 doctests)
- src/tdlib/users.rs - UserCache, LruCache (2 doctests)
Configuration and utilities:
- src/config.rs - Config, ColorsConfig, GeneralConfig (4 doctests)
- src/formatting.rs - format_text_with_entities (2 doctests)
Documentation includes:
- Detailed descriptions of all public structs and methods
- Usage examples with code snippets
- Parameter and return value documentation
- Notes about async behavior and edge cases
- Cross-references between related functions
Total: 34 doctests (30 ignored for async, 4 compiled)
All 464 unit tests passing ✅
Priority 4.12 (Rustdoc) - 100% complete
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2026-02-01 01:03:30 +03:00 |
|
Mikhail Kilin
|
7081a886ad
|
refactor: implement newtype pattern for IDs (P2.4)
Добавлены типобезопасные обёртки ChatId, MessageId, UserId для предотвращения
смешивания разных типов идентификаторов на этапе компиляции.
Изменения:
- Создан src/types.rs с тремя newtype структурами
- Реализованы методы: new(), as_i64(), From<i64>, Display
- Добавлены traits: Hash, Eq, Serialize, Deserialize
- Обновлены 15+ модулей для использования новых типов:
* tdlib: types.rs, chats.rs, messages.rs, users.rs, reactions.rs, client.rs
* app: mod.rs, chat_state.rs
* input: main_input.rs
* tests: app_builder.rs, test_data.rs
- Исправлены 53 ошибки компиляции связанные с type conversions
Преимущества:
- Компилятор предотвращает смешивание разных типов ID
- Улучшенная читаемость кода (явные типы вместо i64)
- Самодокументирующиеся типы
Статус: Priority 2 теперь 60% (3/5 задач)
- ✅ Error enum
- ✅ Config validation
- ✅ Newtype для ID
- ⏳ MessageInfo реструктуризация
- ⏳ MessageBuilder pattern
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2026-01-31 01:33:18 +03:00 |
|