aboutsummaryrefslogtreecommitdiff
path: root/src/cache/mod.rs
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'futures' into v0.6.xZeyla Hellyer2018-05-281-41/+41
|\
| * Remove cache/http methods on structsZeyla Hellyer2018-03-251-6/+4
| |
| * Rewrite the library to use FuturesZeyla Hellyer2018-02-041-30/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrites the library to use Futures. This rewrites all of the gateway, client, cache, most model methods, HTTP, and in a later commit the framework and voice. HTTP has been mostly rewritten to be ergonomic so that it can be used by the user, and has been upgraded to hyper v0.11. The gateway now uses `tokio-tungstenite` v0.4. The client isn't yet in a working state. The models now have a `client` optionally attached to them to make use of `http` and `cache`-utilizing methods. The client isn't needed, in the case that someone is using the library just to deserialize models. The cache is now built around `Rc`s and `RefCell`s, instead of `Arc`s and `RwLock`s. Refer to example 01 for a working example. Much of the library still doesn't work.
| * Fix broken docs links caused by model mod changesZeyla Hellyer2018-02-041-38/+38
| | | | | | | | | | Fix broken links caused by the `model` module changes in v0.5.0, which split up the module into sub-modules for better organization.
* | Refactor imports/exports to use nested groups and better formattingacdenisSK2018-03-291-4/+9
| |
* | Fix broken docs links caused by model mod changesZeyla Hellyer2018-01-311-38/+38
|/ | | | | Fix broken links caused by the `model` module changes in v0.5.0, which split up the module into sub-modules for better organization.
* Break up the model moduleZeyla Hellyer2017-12-161-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `model` module has historically been one giant module re-exporting all of the model types, which is somewhere around 100 types. This can be a lot to look at for a new user and somewhat overwhelming, especially with a large number of fine-grained imports from the module. The module is now neatly split up into submodules, mostly like it has been internally since the early versions of the library. The submodules are: - application - channel - error - event - gateway - guild - id - invite - misc - permissions - prelude - user - voice - webhook Each submodule contains types that are "owned" by the module. For example, the `guild` submodule contains, but not limited to, Emoji, AuditLogsEntry, Role, and Member. `channel` contains, but not limited to, Attachment, Embed, Message, and Reaction. Upgrade path: Instead of glob importing the models via `use serenity::model::*;`, instead glob import via the prelude: ```rust use serenity::model::prelude::*; ``` Instead of importing from the root model module: ```rust use serenity::model::{Guild, Message, OnlineStatus, Role, User}; ``` instead import from the submodules like so: ```rust use serenity::model::channel::Message; use serenity::model::guild::{Guild, Role}; use serenity::model::user::{OnlineStatus, User}; ```
* Re-order use statements alphabeticallyZeyla Hellyer2017-11-111-4/+4
|
* Fix doc-testsacdenisSK2017-11-081-5/+5
|
* Merge v0.4.3acdenisSK2017-11-041-18/+44
|\
| * Fix doctests for a variety of feature targetsZeyla Hellyer2017-11-011-2/+4
| |
| * Fix no-client cache testsZeyla Hellyer2017-11-011-11/+33
| | | | | | | | | | There were a few doctests in the cache module that relied on the client module, so instead feature-gate the doctests.
* | Make the Client return a ResultZeyla Hellyer2017-11-031-2/+6
| | | | | | | | | | | | | | | | The client now returns a Result in preparation of a future commit. Upgrade path: Handle the case of an error via pattern matching, or unwrap the Result.
* | Remove `on_` prefix to EventHandler tymethodsZeyla Hellyer2017-10-221-3/+3
| | | | | | | | | | It was voted that the `on_` prefix is unnecessary, so these have been dropped.
* | Update to account for changes made in 0.4.1acdenisSK2017-10-141-3/+3
|\|
| * Fix clippy lintsZeyla Hellyer2017-10-111-3/+3
| |
| * Generate `Default` for CurrentUser and use it in `Cache::default`acdenisSK2017-10-081-10/+1
| |
| * Revert "Use the de-generification trick."acdenisSK2017-10-031-43/+9
| | | | | | | | Makes the compiliation time just a bit worse
| * Use the de-generification trick.acdenisSK2017-10-021-9/+43
| | | | | | | | Fixes #168
* | Switch to parking_lot::{Mutex, RwLock}Zeyla Hellyer2017-10-101-29/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch to the `parking_lot` crate's implementations of `std::sync::Mutex` and `std::sync::RwLock`, which are more efficient. A writeup on why `parking_lot` is more efficient can be read here: <https://github.com/Amanieu/parking_lot> Upgrade path: Modify `mutex.lock().unwrap()` usage to `mutex.lock()` (not needing to unwrap or handle a result), and `rwlock.read().unwrap()`/`rwlock.write().unwrap()` usage to `rwlock.read()` and `rwlock.write()`. For example, modify: ```rust use serenity::CACHE; println!("{}", CACHE.read().unwrap().user.id); ``` to: ```rust use serenity::CACHE; println!("{}", CACHE.read().user.id); ```
* | Generate `Default` for CurrentUser and use it in `Cache::default`acdenisSK2017-10-091-10/+1
| |
* | Revert "Use the de-generification trick."acdenisSK2017-10-091-43/+9
| | | | | | | | Makes the compiliation time just a bit worse
* | Use the de-generification trick.acdenisSK2017-10-091-9/+43
|/ | | | Fixes #168
* Apply rustfmtZeyla Hellyer2017-09-181-3/+3
|
* Fix compiles of a variety of feature combinationsZeyla Hellyer2017-09-181-0/+1
| | | | | This fixes compilation errors and warnings when compiling a mixture of non-default feature targets.
* Don't clone in Cache::all_guilds/private_channelsZeyla Hellyer2017-09-141-5/+3
| | | | We don't need to clone the Vec, if the user needs to they can.
* Put the cloning at a later stageacdenisSK2017-09-141-2/+2
|
* Revamp `CacheEventsImpl`acdenisSK2017-09-121-3/+7
|
* Apply rustfmt + fix testsZeyla Hellyer2017-09-091-1/+3
|
* Implement categoriesacdenisSK2017-09-091-0/+8
|
* Add ability to play DCA and Opus files. (#148)Maiddog2017-08-271-4/+4
|
* Revamp `RwLock` usage in the libacdenisSK2017-08-241-5/+5
| | | | Also not quite sure if they goofed rustfmt or something, but its changes it did were a bit bizarre.
* Apply rustfmtZeyla Hellyer2017-08-181-3/+3
|
* Put `update_user_entry` back into the cacheacdenisSK2017-08-111-1/+12
| | | | Not really related to the events by any means
* Split event handling in the cache to a traitacdenisSK2017-08-101-473/+4
| | | | note: This trait might become like `framework::Framework` in the future.
* Remove uneccessary mapacdenisSK2017-08-041-2/+2
|
* Change the config a bit, and a few nitpicksacdenisSK2017-07-271-34/+32
|
* rustfmtacdenisSK2017-07-271-104/+130
|
* Remove the deprecated functionsacdenisSK2017-07-111-67/+0
| | | | It's already been enough time for people to migrate
* Actually, use `unreachable!` instead of `panic!`acdenisSK2017-07-071-1/+1
|
* Apply the new api change for dms in botsacdenisSK2017-07-071-35/+19
|
* Fix doc testsacdenisSK2017-07-021-40/+52
|
* Docs fixesmei2017-06-271-49/+11
|
* Switch from #[doc(hidden)] to pub(crate)alex2017-06-141-47/+25
| | | | | | Switch from using `#[doc(hidden)]` to hide some internal functions to `pub(crate)`. The library now requires rustc 1.18.
* Make Member::guild_id non-optionalZeyla Hellyer2017-06-131-1/+1
| | | | All codepaths result in Some value, so it doesn't need to be optional.
* Deprecate Client::login, add Client::newZeyla Hellyer2017-06-061-3/+3
|
* Clippy lintsZeyla Hellyer2017-06-061-3/+3
|
* Use chrono for struct timestamp fieldsZeyla Hellyer2017-06-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Chrono is easier to use than timestamped strings, so they should be automatically deserialized and available for the user, instead of having the user deserialize the strings themselves. These fields have been changed to use a type of `DateTime<FixedOffset>`: - `ChannelPinsUpdateEvent.last_pin_timestamp` - `Group.last_pin_timestamp` - `Guild.joined_at` - `GuildChannel.last_pin_timestamp` - `Invite.created_at` - `Member.joined_at` - `Message.edited_timestamp - `Message.timestamp` - `MessageUpdateEvent.edited_timestamp` - `MessageUpdateEvent.timestamp` - `PrivateChannel.last_pin_timestamp` `Member.joined_at` is now also an `Option`. Previously, if a Guild Member Update was received for a member not in the cache, a new Member would be instantiated with a default String value. This is incorrect behaviour, and has now been replaced with being set to `None` in that case. Id methods' `created_at()` method now return a `chrono::NaiveDateTime` instead of a `time::Timespec`, and `User::created_at` has been updated to reflect that. Additionally, drop `time` as a direct dependency and use chrono for internals.
* Add cache docsMaiddog2017-05-301-0/+115
|
* Add more examples and improve some othersZeyla Hellyer2017-05-231-5/+64
| | | | | Add examples to some functions, and update some of the old examples to use the `?` operator instead of unwrapping.