aboutsummaryrefslogtreecommitdiff
path: root/src/model/guild/member.rs
Commit message (Collapse)AuthorAgeFilesLines
* Monomorphize all functionsZeyla Hellyer2018-07-041-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit monomorphizes all functions, turning functions like: ```rust fn foo<T: Into<Bar>>(baz: T) { baz = baz.into(); // function here } ``` Into functions like: ```rust fn foo<T: Into<Bar>>(baz: T) { _foo(baz.into()) } fn _foo(baz: Bar) { // function here } ``` This avoids binary bloat and improves build times, by reducing the amount of code duplication.
* Remove deadlocking in Member::highest_role_infoZeyla Hellyer2018-05-271-8/+6
| | | | | | Instead of calling `parking_lot::RwLock::read` on the member's guild, call `parking_lot::RwLock::try_read` and return None early if it would cause a deadlock.
* Add `Message::member` structfieldZeyla Hellyer2018-05-211-2/+20
| | | | | Adds the `Message::member` structfield, which contains a partial amount of member data (deaf and mute status, role IDs, and joined_at).
* Refactor imports/exports to use nested groups and better formattingacdenisSK2018-03-291-1/+5
|
* Fix broken docs links caused by model mod changesZeyla Hellyer2018-01-311-1/+1
| | | | | Fix broken links caused by the `model` module changes in v0.5.0, which split up the module into sub-modules for better organization.
* Fix compilationZeyla Hellyer2018-01-061-5/+4
|
* Add some role position hierarchy checksZeyla Hellyer2018-01-061-8/+10
|
* Add Member::highest_role_infoZeyla Hellyer2018-01-061-0/+40
|
* Implement or derive Serialize on all modelsZeyla Hellyer2018-01-011-2/+3
|
* Improve performance of builders even furtheracdenisSK2017-12-271-3/+3
| | | | | | By negating hashing altogether. The increase is around 1000-ish nanoseconds saved.
* Fix most clippy lints, take more refeerncesZeyla Hellyer2017-12-161-2/+2
| | | | | Fix clippy lints and subsequently accept references for more function parameters.
* Break up the model moduleZeyla Hellyer2017-12-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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}; ```
* Convert from macro to ? (#226)Mei Boudreau2017-11-231-1/+1
|
* Re-order use statements alphabeticallyZeyla Hellyer2017-11-111-5/+5
|
* Whoops. Add a `FromStr` impl for `ReactionType`acdenisSK2017-11-041-3/+3
|
* Merge v0.4.3acdenisSK2017-11-041-14/+5
|\
| * Make Member::permissions return guild permissionsZeyla Hellyer2017-10-311-11/+3
| | | | | | | | | | | | Fixes what is realistically a bug where `Member::permissions` would retrieve the permissions for the Member in the default channel of the guild. This now only returns the guild-level permissions of the member.
| * Rename `Guild::permissions_for`->`permissions_in`Zeyla Hellyer2017-10-301-2/+2
| | | | | | | | | | | | Rename `Guild::permissions_for` to `Guild::permissions_in`, deprecating `Guild::permissions_for` which is only an inline method to `permissions_in`.
| * Add some docs to `BanOptions`acdenisSK2017-10-301-0/+1
| |
* | Slightly improve performance of buildersZeyla Hellyer2017-10-181-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Builders would keep a `serde_json::Map<String, Value>`, which would require re-creating owned strings for the same parameter multiple times in some cases, depending on builder defaults and keying strategies. This commit uses a `std::collections::HashMap<&'static str, Value>` internally, and moves over values to a `serde_json::Map<String, Value>` when it comes time to sending them to the appropriate `http` module function. This saves the number of heap-allocated string creations on most builders, with specific performance increase on `builder::CreateMessage` and `builder::CreateEmbed` & co.
* | Fix some compilation feature targets, fix lintsZeyla Hellyer2017-10-171-0/+1
| |
* | Update to account for changes made in 0.4.1acdenisSK2017-10-141-23/+11
|\|
| * Add try_opt macro for substituteMei Boudreau2017-10-121-4/+1
| |
| * Optimize Member::rolesMei Boudreau2017-10-121-21/+11
| |
| * Add an impl for `&str`acdenisSK2017-10-081-0/+4
| |
| * Revert "Use the de-generification trick."acdenisSK2017-10-031-14/+8
| | | | | | | | Makes the compiliation time just a bit worse
| * Use the de-generification trick.acdenisSK2017-10-021-8/+14
| | | | | | | | Fixes #168
* | Switch to parking_lot::{Mutex, RwLock}Zeyla Hellyer2017-10-101-25/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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); ```
* | Add an impl for `&str`acdenisSK2017-10-091-0/+4
| |
* | Revert "Use the de-generification trick."acdenisSK2017-10-091-14/+8
| | | | | | | | Makes the compiliation time just a bit worse
* | Use the de-generification trick.acdenisSK2017-10-091-8/+14
| | | | | | | | Fixes #168
* | Change behaviour of default_channel (#185)Mei Boudreau2017-10-071-1/+21
| |
* | Change default_channel to return a pointer (#179)Mei Boudreau2017-10-051-1/+3
|/
* Update bitflags, other dependenciesZeyla Hellyer2017-09-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Bitflags changed its macro codegen from creating constants to associated constants on structs. Upgrade path: Update code from: ```rust use serenity::model::permissions::{ADD_REACTIONS, MANAGE_MESSAGES}; foo(vec![ADD_REACTIONS, MANAGE_MESSAGES]); ``` to: ```rust use serenity::model::Permissions; foo(vec![Permissions::ADD_REACTIONS, Permissions::MANAGE_MESSAGES]); ```
* Apply rustfmtZeyla Hellyer2017-09-181-15/+18
|
* Fix compiles of a variety of feature combinationsZeyla Hellyer2017-09-181-2/+2
| | | | | This fixes compilation errors and warnings when compiling a mixture of non-default feature targets.
* Apply rustfmt + fix testsZeyla Hellyer2017-09-091-3/+4
|
* Update `Guild::ban` to use `BanOptions`acdenisSK2017-09-061-1/+9
| | | | Also update `Member::permissions` to the default channel change
* Add ability to play DCA and Opus files. (#148)Maiddog2017-08-271-19/+16
|
* Revamp `RwLock` usage in the libacdenisSK2017-08-241-16/+19
| | | | Also not quite sure if they goofed rustfmt or something, but its changes it did were a bit bizarre.
* Fix rustfmt lines that are too longZeyla Hellyer2017-08-181-1/+1
| | | | | Apparently rustfmt can't fix some of these, causing it to exit with 3 and therefore failing the build.
* Apply rustfmtZeyla Hellyer2017-08-181-18/+15
|
* Clippy and rustfmtacdenisSK2017-08-011-1/+1
|
* Provide the input and limit back to the user, and do some consistenciesacdenisSK2017-08-011-2/+7
|
* Change the config a bit, and a few nitpicksacdenisSK2017-07-271-8/+15
|
* rustfmtacdenisSK2017-07-271-68/+68
|
* Improve `BanOptions` to be more efficient and remove uneccessary `Read` importsacdenisSK2017-07-131-9/+9
|
* Remove the deprecated functionsacdenisSK2017-07-111-8/+0
| | | | It's already been enough time for people to migrate
* Return an error if the reason the user provided exceeded the limitacdenisSK2017-07-101-1/+7
|
* Use a trait way of overloading the `ban` function instead of an enumacdenisSK2017-07-101-30/+31
| | | | Possibly removes some overhead introduced by enums but makes the underlaying code of the function easier to read and is more concise