Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use foldhash in ExtractMap<K, V> within model/cache instead of std's ` hasher #3113

Draft
wants to merge 183 commits into
base: next
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
be6dfd8
Remove temporary `Vec` usage in the `http` module (#2624, #2646)
GnomedDev Dec 3, 2023
026fa18
Remove deprecated items (#2645)
GnomedDev Dec 3, 2023
bc8e362
Remove more deprecated items (#2651)
GnomedDev Dec 8, 2023
473ee03
Remove `*_arc` methods (#2654)
GnomedDev Dec 8, 2023
f394d5c
Clean up `ShardManager`/`ShardQueuer`/`ShardRunner` (#2653)
GnomedDev Dec 9, 2023
0110e3c
Put `Message::thread` behind a `Box` (#2658)
GnomedDev Dec 9, 2023
07d43f8
Replace `Vec` and `String` with `FixedArray` and `FixedString` for al…
GnomedDev Dec 10, 2023
6e16917
Fix truncation when using `FixedString<u8>` where multibyte character…
GnomedDev Dec 14, 2023
79a3b54
Encode timestamps in RFC3339 (#2665)
Kerollmops Dec 22, 2023
ec43e8e
Switch to `i64` in methods associated with `CreateCommandOption` (#2668)
ARandomDev99 Dec 22, 2023
a5d83ab
Get rid of the duplicate users cache (#2662)
GnomedDev Dec 28, 2023
1c500c3
Change `Embed::fields` to use `FixedArray` (#2674)
GnomedDev Dec 28, 2023
b51c8a0
Use `FixedArray` and `FixedString` in model enums (#2675)
GnomedDev Dec 28, 2023
e919277
Bitpack boolean fields using fancy proc macro (#2673)
GnomedDev Dec 31, 2023
c33ce0e
Use `nonmax::NonMax*` types in `Option`s wherever possible (#2681)
GnomedDev Jan 2, 2024
3100112
Remove unused warning `#[allow(...)]`s (#2682)
GnomedDev Jan 2, 2024
39f0326
Get rid of `unsafe` (#2686)
GnomedDev Jan 3, 2024
59be2c2
Swap Git dependencies for crates.io published versions (#2685)
GnomedDev Jan 3, 2024
45b440e
Swap Id from `NonZero` to `NonMax` (#2689)
GnomedDev Jan 5, 2024
d1c6aa1
Rewrite builders to take `Cow`s (#2688)
GnomedDev Jan 6, 2024
441e303
Store `Request::params` as a slice instead of owning `ArrayVec` (#2694)
GnomedDev Jan 7, 2024
dbd3942
Revert `Request::params` back to `Option` (#2695)
mkrasnitski Jan 7, 2024
45d9cd6
Remove unnecessary `Vec` in `WsClient` (#2705)
GnomedDev Jan 10, 2024
cb85279
Feature gate `#[instrument]` macros (#2707)
GnomedDev Jan 10, 2024
562e657
Remove `impl Into<Option>` (#2701)
GnomedDev Jan 10, 2024
b179e6c
Get rid of `IntoIterator` generics wherever they are inefficent (#2698)
GnomedDev Jan 10, 2024
cd50113
Clean up `Ratelimiter` (#2687)
GnomedDev Jan 10, 2024
d78c4f5
Handle overflow checks in central locations (#2697)
GnomedDev Jan 10, 2024
897a0d0
Shrink size and clean up `Error` (#2700)
GnomedDev Jan 10, 2024
68650b5
Remove manual `#[inline]` attributes (#2702)
GnomedDev Jan 10, 2024
d8bb143
Remove `Into<*Id>` and `AsRef<str>` (#2704)
GnomedDev Jan 11, 2024
8973191
Remove `Event::Unknown` variant (#2708)
mkrasnitski Jan 12, 2024
3ba0b94
Use `NonMax` to signal builder range constraints (#2703)
GnomedDev Jan 14, 2024
ef1d191
Stop using `Value` in error parsing (#2710)
GnomedDev Jan 14, 2024
5f7e7b5
Fix new clippy lints (#2713)
GnomedDev Jan 14, 2024
9a4a739
Update to `small-fixed-array` v0.2 (#2711)
GnomedDev Jan 14, 2024
83fa13e
Fix `@everyone` role deserialisation (#2716)
GnomedDev Jan 16, 2024
cff1a67
Fix `GuildChannel` deserialisation with `user_limit` (#2715)
GnomedDev Jan 16, 2024
dda61eb
Fix maximum description length to the correct size (#2718)
Milo123459 Jan 16, 2024
1f67103
Remove dashboard example (#2714)
GnomedDev Jan 16, 2024
7a7f0e6
Fix compilation from rebase
arqunis Jan 16, 2024
6e2abe2
Remove deprecated `absolute_ratelimits` feature (#2719)
GnomedDev Jan 16, 2024
c08e676
Implement `max_concurrency` support when starting shards (#2661)
mkrasnitski Jan 16, 2024
2594ef4
Remove typemap without making everything generic (#2720)
GnomedDev Jan 16, 2024
eb18e19
Provide `Arc<Data>` instead of `&Data` (#2722)
GnomedDev Jan 17, 2024
c398881
Add `Client::try_data` to fallibly fetch the data type (#2723)
GnomedDev Jan 18, 2024
821090f
Fix voice manager initialisation (#2727)
GnomedDev Jan 21, 2024
c7fb774
Remove some pedantic lints from the whitelist (#2728)
mkrasnitski Jan 21, 2024
d4aaa0c
Reduce unknown events to debug level, again (#2730)
GnomedDev Jan 21, 2024
499ab9a
Fix compilation from rebase
arqunis Jan 22, 2024
be79a45
Fix testing example
mkrasnitski Jan 22, 2024
748777c
Remove `PartialEq` implementations from all builders (#2734)
mkrasnitski Jan 22, 2024
c5cf6b7
Remove various instances of `impl AsRef<T>` (#2736)
GnomedDev Jan 24, 2024
3ce3548
Remove `simd-json` support (#2735)
GnomedDev Jan 24, 2024
de5d163
Fix massive code size of `client::dispatch` (#2739)
GnomedDev Jan 25, 2024
adbd6b1
Fix RoleTags deserialisation after removal of simd-json (#2742)
GnomedDev Jan 26, 2024
b9f6a57
Avoid cloning FullEvent in dispatch code (#2740)
GnomedDev Jan 27, 2024
427aa31
Remove the builder trait and only take required arguments (#2741)
GnomedDev Jan 27, 2024
f3b5a52
Use Serializer::collect_seq in serialize impls (#2744)
GnomedDev Jan 28, 2024
d60cf71
Convert enum number into wrapper struct to save type sizes (#2746)
GnomedDev Jan 29, 2024
207ae15
Use Arc<str> to store the token (#2745)
GnomedDev Jan 29, 2024
aae79a2
Remove standard framework (#2731)
GnomedDev Jan 29, 2024
04caf65
Re-add Secret to bot token (#2748)
GnomedDev Jan 29, 2024
0e46172
Take Arc<Http> in ClientBuilder::new_with_http (#2749)
GnomedDev Feb 3, 2024
0ec1c10
Remove duplicate content_safe implementation (#2759)
GnomedDev Feb 9, 2024
49874a7
Simplify the message cache (#2757)
GnomedDev Feb 9, 2024
c63422e
Upgrade to small-fixed-array 0.4 (#2755)
GnomedDev Feb 9, 2024
f7f9e32
Avoid HashMap in ShardQueue (#2750)
GnomedDev Feb 11, 2024
7c7b66c
Switch to a generic type argument for `ClientBuilder::data` (#2765)
vicky5124 Feb 11, 2024
798f2b2
Fix `VoiceServerUpdate::guild_id` being wrapped in `Option` (#2766)
GnomedDev Feb 13, 2024
0d8518d
Improve MessageBuilder to fit with other builders (#2767)
GnomedDev Feb 15, 2024
37f7c2b
Fill message cache with ChannelId::messages and ChannelId::pins (#2768)
GnomedDev Feb 15, 2024
74f0e30
Defer deserialisation of Dispatch to handle errors (#2764)
GnomedDev Feb 16, 2024
6085c00
Remove `CreateAttachment::id` field (#2771)
mkrasnitski Feb 17, 2024
b229365
Fix compilation from rebase
arqunis Mar 1, 2024
3304cba
Fix remaining clippy warnings
GnomedDev Mar 1, 2024
f086ef7
Format unformatted code from rebase
arqunis Mar 1, 2024
85db8c2
Remove rebase artifacts in README
arqunis Mar 1, 2024
013db03
Synchronise README example from the `current` branch
arqunis Mar 1, 2024
a395e4c
Minor adjustments
mkrasnitski Mar 1, 2024
326acf4
Apply Strum derives for FullEvent and Event (#2788)
cheesycod Mar 10, 2024
a1ce705
Remove `Channel::name` (#2787)
GnomedDev Mar 10, 2024
2301272
Use join_to_string throughout serenity (#2785)
GnomedDev Mar 10, 2024
88591af
Use ToArrayString for int -> str (#2786)
GnomedDev Mar 10, 2024
04279e9
Rename `unstable_discord_api` to `unstable` and disable it by default…
cheesycod Mar 10, 2024
84030dd
Remove deprecated Channel::is_nsfw methods (#2792)
GnomedDev Mar 11, 2024
983fa5c
Replace manual Hash/Eq implementation on User/Role (#2793)
GnomedDev Mar 12, 2024
d9dbe16
Remove useless method wrappers (#2795)
GnomedDev Mar 13, 2024
65c2d86
Fix unused variable warning from rebase
GnomedDev Mar 13, 2024
90a2648
Remove deprecated mapped refs and Cache::channels (#2796)
GnomedDev Mar 13, 2024
122a852
Use ExtractMap instead of HashMap when possible (#2797)
GnomedDev Mar 17, 2024
110f2a7
Remove examples and inaccurate docs from HTTP (#2805)
GnomedDev Mar 17, 2024
8fcbe6f
Use NonMax in HTTP function signatures (#2803)
GnomedDev Mar 17, 2024
422cba3
Fix infinite loop in event deserialisation
arqunis Mar 19, 2024
b84b870
Make Guild::shard_id follow additive features (#2813)
GnomedDev Mar 21, 2024
9a4b69e
Remove deprecated `Member` and `Guild` methods (#2817)
GnomedDev Mar 26, 2024
798ced7
Replace `CacheHttp` with `&Http` in more methods (#2818)
GnomedDev Mar 28, 2024
b0813e7
Remove `serde_json::Value` from `Http` (#2806)
GnomedDev Mar 28, 2024
cd86f33
Add audit log reasons to remaining model methods (#2821)
GnomedDev Mar 29, 2024
00f4ac7
Remove even more impl CacheHttp (#2822)
GnomedDev Mar 29, 2024
6cce475
Remove `fs` feature for `tokio` by default (#2824)
UserIsntAvailable Mar 30, 2024
e7f5c56
Update `reqwest` to v0.12 (#2826)
GnomedDev Apr 1, 2024
42410af
Only include `cache::Settings::time_to_live` if temp cache is enabled…
GnomedDev Apr 3, 2024
d2234f4
Add resume_gateway_url support (#2832)
GnomedDev Apr 6, 2024
49ac2aa
Correct documentation for `UserId::to_user` (#2809)
jamesbt365 Apr 9, 2024
b7792c2
Use CreateAttachment for EditGuild::banner (#2844)
NotNorom Apr 20, 2024
f19db06
Fix AuditLogEntry::user_id (#2846)
GnomedDev Apr 20, 2024
5056049
Restore match arm for `Error::Gateway` variant (#2847)
mkrasnitski Apr 22, 2024
de74f44
Remove multiple event handler support (#2849)
GnomedDev Apr 24, 2024
fb87272
Use RwLock for active collectors collection (#2851)
TheCataliasTNT2k Apr 26, 2024
fb0d3d1
Provide old presence data from the cache on presence update (#2852)
jamesbt365 Apr 28, 2024
77bcd38
Allow filtering events before they are dispatched (#2853)
TheCataliasTNT2k Apr 28, 2024
7bd3990
Remove permission checks (#2855)
jamesbt365 May 1, 2024
6aa6762
Implement ToArrayString for Mention (#2857)
GnomedDev May 7, 2024
02b1eb7
Add PartialGuild::greater_member_hierarchy + member_highest_role (#2856)
cheesycod May 8, 2024
68d714f
Remove recently deprecated items
GnomedDev May 23, 2024
0de2945
Update bool_to_bitflags to fix compilation without unstable
GnomedDev May 14, 2024
d7ff24b
Remove RUSTFLAGS from .cargo/config.toml (#2875)
jamesbt365 May 23, 2024
631b82e
Remove deprecated link_ensured method (#2898)
GnomedDev Jun 10, 2024
bdbc2fe
Add GuildId param to ChannelId::to_channel (#2895)
GnomedDev Jun 16, 2024
a2a22cb
Clean up `Message::reply` (#2897)
GnomedDev Jun 16, 2024
3b96925
Use `ArrayString` in more places via `aformat!` (#2902)
GnomedDev Jun 22, 2024
b1a1956
Bump MSRV to Rust 1.79 (#2916)
mkrasnitski Jul 11, 2024
05cbc50
Remove deprecated `CreateInteractionResponse::PremiumRequired` varian…
mkrasnitski Aug 5, 2024
3d1e6c3
Add `OAuth2Token`, `OAuth2TokenRevocation`, and `OAuth2AuthorizationC…
valentinegb Aug 8, 2024
dfc4268
Allow setting both normal and raw event handlers (#2933)
tazz4843 Aug 16, 2024
a6c1d39
Merge `client` feature/module into `gateway` (#2947)
mkrasnitski Aug 22, 2024
ebed61d
Remove methods on `ClientBulder` that don't serve a purpose (#2953)
mkrasnitski Aug 23, 2024
e9e147a
Fix and make `edit_role_position` plural (#2954)
mkrasnitski Aug 23, 2024
7e52017
Fix model functions using `SerializeIter` (#2955)
GnomedDev Aug 26, 2024
bb1e6a2
Remove `InternalEventHandler` (#2952)
mkrasnitski Aug 26, 2024
2e9546f
Truncate cache if `max_messages` is set to a lower value at runtime (…
ivinjabraham Aug 30, 2024
6abdd76
Add enum for JSON error codes in `DiscordJsonError` (#2964)
ivinjabraham Sep 1, 2024
2164e96
Update to DashMap 6 (#2961)
GnomedDev Sep 9, 2024
6bec29a
Fix unused warnings when compiling without certain features (#2970)
mkrasnitski Sep 13, 2024
cf92bc6
Fix public doctests that are marked `ignore` (#2976)
mkrasnitski Sep 20, 2024
aa5c34a
Allow embeds to be optional in followup messages (#2968)
TapGhoul Oct 7, 2024
8b8363b
Swap `Vec<T>` for `Cow<[T]>` in `CreateActionRow::Buttons` (#2985)
GnomedDev Oct 7, 2024
53bfd98
Remove more `json!` usage (#2986)
GnomedDev Oct 7, 2024
37a82dc
Replace outdated secrecy library with own impl (#2997)
GnomedDev Oct 21, 2024
a76f918
Check for lints which change public API (#2999)
GnomedDev Oct 21, 2024
7b2f858
Stop using serde_json::Value in AutocompleteChoice::value (#3000)
GnomedDev Oct 21, 2024
40dc321
feat: Make FullEvent serializable (#3010)
cheesycod Oct 31, 2024
d541140
Add `Context::data_ref` (#3017)
GnomedDev Nov 6, 2024
a55c3a3
Delete passthrough methods (#3023)
GnomedDev Nov 11, 2024
61bee60
Swap CreateAttachment::data to Bytes (#3016)
GnomedDev Nov 11, 2024
2cd58e5
Add `EditCommand` builder (#3028)
mkrasnitski Nov 12, 2024
b3d2436
Remove deprecated GuildChannel::permissions_for_user (#3033)
GnomedDev Nov 13, 2024
1a8e440
Improve some docs (#3027)
mkrasnitski Nov 13, 2024
e2b5fcc
Add config for the shard start wait time (#3031)
cheesycod Nov 13, 2024
d11cd01
Remove Option around Interaction::app_permissions (#3034)
GnomedDev Nov 13, 2024
caefe48
Remove deprecated permissions methods (#3042)
GnomedDev Nov 16, 2024
76aeaa2
Update `tokio-tungstenite` dependency to 0.24 (#3048)
DPlayer234 Nov 18, 2024
c02c0a4
Perform some misc TODO cleanups (#3050)
GnomedDev Nov 18, 2024
7e24172
Transport compression support (#3036)
fgardt Nov 18, 2024
503862c
Get rid of redundant status argument in Http::wind (#3049)
GnomedDev Nov 18, 2024
fb84982
Perform some minor cleanups (#3051)
mkrasnitski Nov 19, 2024
53660a1
Improve token semantics and clean up gateway feature gates (#3052)
mkrasnitski Nov 22, 2024
23ba23e
Add Token to serenity::all (#3054)
GnomedDev Nov 22, 2024
4be2200
Use correct token prefix after parsing
arqunis Nov 23, 2024
36d9659
Add guild_id to ReactionRemoveAll (#3058)
jamesbt365 Nov 25, 2024
8197403
Bump the discriminant of audit_log::Action to u16 (#3062)
GnomedDev Nov 25, 2024
7a68c36
Fix transport compression feature & add CI tests (#3067)
fgardt Nov 26, 2024
14db100
Factor out collector methods on models into traits (#3055)
mkrasnitski Nov 27, 2024
8b50647
Remove unused `json.rs` file (#3071)
mkrasnitski Dec 2, 2024
6f2fc48
Fix clippy warning on next (#3078)
mkrasnitski Dec 8, 2024
8c24ef3
Add a function for parsing a channel ID from a channel URL (#3075)
TheCataliasTNT2k Dec 8, 2024
cbfc682
Fix clippy warning (#3081)
mkrasnitski Dec 9, 2024
56a7dec
Add `newly_created` bool field to the `ThreadCreate` event (#3084)
jamesbt365 Dec 19, 2024
7473026
Fix deserialisation of `Token` type (#3086)
arqunis Jan 9, 2025
b59b693
Fix issues from rebase
arqunis Jan 16, 2025
9c69934
Remove `ContentSafeOptions::show_discriminator`
arqunis Jan 16, 2025
4b76dd2
Change MessageUpdateEvent to just contain a full Message (#3061)
GnomedDev Jan 19, 2025
454935f
Improve gateway connection/resume logic (#3099)
mkrasnitski Jan 27, 2025
06d2352
Update `tokio-tungstenite` to v0.26.1
Cabbache Jan 30, 2025
6bc1e5b
Fix clippy
arqunis Feb 2, 2025
9d14449
Fix disconnections on successful gateway resume (#3102)
mkrasnitski Feb 3, 2025
ce38b8f
Deserialise `Token` from `String`s instead of `&str`s (#3104)
Freyja-moth Feb 4, 2025
38ac76b
Fix clippy
mkrasnitski Feb 8, 2025
3923997
Fix compilation when the `tracing_instrument` feature is enabled (#3110)
mkrasnitski Feb 11, 2025
025eacb
Swap `fxhash` for `foldhash` due to hash quality issues (#3111)
xacrimon Feb 13, 2025
2588a25
use foldhash instead of std's RandomState in ExtractMap's
xacrimon Feb 14, 2025
13857fa
add TODO to restore the temp dep patch
xacrimon Feb 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .cargo/config.toml

This file was deleted.

2 changes: 0 additions & 2 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
ci:
- .github/**/*
command_attr:
- command_attr/**/*
examples:
- examples/**/*
builder:
Expand Down
62 changes: 29 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: CI
on: [push, pull_request]

env:
rust_min: 1.74.0
rust_nightly: nightly-2024-03-09
rust_min: 1.82.0
rust_nightly: nightly-2024-11-01

jobs:
test:
Expand All @@ -26,7 +26,9 @@ jobs:
- no cache
- no gateway
- unstable Discord API features
- simd-json
- zlib compression
- zstd compression
- zlib and zstd compression

include:
- name: beta
Expand All @@ -38,22 +40,26 @@ jobs:
- name: no default features
features: " "
- name: no cache
features: builder client framework gateway model http standard_framework utils rustls_backend
- name: simd-json
features: default_no_backend rustls_backend simd_json
features: framework rustls_backend
- name: no gateway
features: model http rustls_backend
features: model rustls_backend
- name: chrono
features: chrono
- name: unstable API + typesize
features: default unstable_discord_api typesize
features: default unstable typesize
dont-test: true
- name: builder without model
features: builder
dont-test: true
- name: unstable Discord API (no default features)
features: unstable_discord_api
features: unstable
dont-test: true
- name: zlib compression
features: default transport_compression_zlib
- name: zstd compression
features: default transport_compression_zstd
- name: zlib and zstd compression
features: default transport_compression_zlib transport_compression_zstd

steps:
- name: Checkout sources
Expand Down Expand Up @@ -131,9 +137,6 @@ jobs:
- name: Cache
uses: Swatinem/rust-cache@v2

- name: Remove cargo build config
run: rm .cargo/config.toml

- name: Build
run: cargo build

Expand Down Expand Up @@ -210,8 +213,7 @@ jobs:

- name: Build docs
run: |
cargo doc --no-deps --features collector,voice,unstable_discord_api
cargo doc --no-deps -p command_attr
cargo doc --no-deps --features full,unstable
env:
RUSTDOCFLAGS: -D rustdoc::broken_intra_doc_links

Expand Down Expand Up @@ -241,32 +243,26 @@ jobs:
- name: 'Check example 4'
run: cargo check -p e04_message_builder
- name: 'Check example 5'
run: cargo check -p e05_command_framework
run: cargo check -p e05_sample_bot_structure
- name: 'Check example 6'
run: cargo check -p e06_sample_bot_structure
run: cargo check -p e06_env_logging
- name: 'Check example 7'
run: cargo check -p e07_env_logging
run: cargo check -p e07_shard_manager
- name: 'Check example 8'
run: cargo check -p e08_shard_manager
- name: 'Check example 9'
run: cargo check -p e09_create_message_builder
run: cargo check -p e08_create_message_builder
- name: 'Check example 09'
run: cargo check -p e09_collectors
- name: 'Check example 10'
run: cargo check -p e10_collectors
run: cargo check -p e10_gateway_intents
- name: 'Check example 11'
run: cargo check -p e11_gateway_intents
run: cargo check -p e11_global_data
- name: 'Check example 12'
run: cargo check -p e12_global_data
run: cargo check -p e12_parallel_loops
- name: 'Check example 13'
run: cargo check -p e13_parallel_loops
run: cargo check -p e13_sqlite_database
- name: 'Check example 14'
run: cargo check -p e14_slash_commands
run: cargo check -p e14_message_components
- name: 'Check example 15'
run: cargo check -p e15_simple_dashboard
run: cargo check -p e15_webhook
- name: 'Check example 16'
run: cargo check -p e16_sqlite_database
- name: 'Check example 17'
run: cargo check -p e17_message_components
- name: 'Check example 18'
run: cargo check -p e18_webhook
- name: 'Check example 19'
run: cargo check -p e19_interactions_endpoint
run: cargo check -p e16_interactions_endpoint
1 change: 0 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
RUSTDOCFLAGS: --cfg docsrs -D warnings
run: |
cargo doc --no-deps --features full
cargo doc --no-deps -p command_attr

- name: Prepare docs
shell: bash -e -O extglob {0}
Expand Down
7 changes: 3 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@ your code.

## Unsafe

Code that defines or uses `unsafe` functions must be reasoned with comments.
`unsafe` code can pose a potential for undefined behaviour related bugs and other
kinds of bugs to sprout if misused, weakening security. If you commit code containing
`unsafe`, you should confirm that its usage is necessary and correct.
Unsafe code is forbidden, and safe alternatives must be found. This can be mitigated by using
a third party crate to offload the burden of justifying the unsafe code, or finding a safe
alternative.

# Comment / Documentation style

Expand Down
91 changes: 46 additions & 45 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,49 +24,55 @@ repository = "https://github.com/serenity-rs/serenity.git"
keywords = ["discord", "api"]
license = "ISC"
edition = "2021"
rust-version = "1.74"
rust-version = "1.82"

[dependencies]
# Required dependencies
bitflags = "2.4.2"
serde_json = "1.0.108"
async-trait = "0.1.74"
tracing = { version = "0.1.40", features = ["log"] }
serde = { version = "1.0.192", features = ["derive"] }
serde = { version = "1.0.192", features = ["derive", "rc"] }
url = { version = "2.4.1", features = ["serde"] }
tokio = { version = "1.34.0", features = ["fs", "macros", "rt", "sync", "time", "io-util"] }
tokio = { version = "1.34.0", features = ["macros", "rt", "sync", "time", "io-util"] }
futures = { version = "0.3.29", default-features = false, features = ["std"] }
time = { version = "0.3.36", features = ["formatting", "parsing", "serde-well-known"] }
base64 = { version = "0.22.0" }
secrecy = { version = "0.8.0", features = ["serde"] }
zeroize = { version = "1.7" } # Not used in serenity, but bumps the minimal version from secrecy
arrayvec = { version = "0.7.4", features = ["serde"] }
serde_cow = { version = "0.1.0" }
small-fixed-array = { version = "0.4", features = ["serde"] }
bool_to_bitflags = { version = "0.1.2" }
nonmax = { version = "0.5.5", features = ["serde"] }
strum = { version = "0.26", features = ["derive"] }
to-arraystring = "0.2.0"
extract_map = { version = "0.1.0", features = ["serde", "iter_mut"] }
aformat = "0.1.3"
bytes = "1.5.0"
foldhash = "0.1.4"
# Optional dependencies
fxhash = { version = "0.2.1", optional = true }
simd-json = { version = "0.13.4", optional = true }
uwl = { version = "0.6.0", optional = true }
levenshtein = { version = "1.0.5", optional = true }
chrono = { version = "0.4.31", default-features = false, features = ["clock", "serde"], optional = true }
flate2 = { version = "1.0.28", optional = true }
reqwest = { version = "0.11.22", default-features = false, features = ["multipart", "stream"], optional = true }
static_assertions = { version = "1.1.0", optional = true }
tokio-tungstenite = { version = "0.21.0", optional = true }
typemap_rev = { version = "0.3.0", optional = true }
bytes = { version = "1.5.0", optional = true }
zstd-safe = { version = "7.2.1", optional = true }
reqwest = { version = "0.12.2", default-features = false, features = ["multipart", "stream", "json"], optional = true }
tokio-tungstenite = { version = "0.26.1", features = ["url"], optional = true }
percent-encoding = { version = "2.3.0", optional = true }
mini-moka = { version = "0.10.2", optional = true }
mime_guess = { version = "2.0.4", optional = true }
dashmap = { version = "5.5.3", features = ["serde"], optional = true }
parking_lot = { version = "0.12.1", optional = true }
dashmap = { version = "6.1.0", features = ["serde"], optional = true }
parking_lot = { version = "0.12.1"}
ed25519-dalek = { version = "2.0.0", optional = true }
typesize = { version = "0.1.2", optional = true, features = ["url", "time", "serde_json", "secrecy", "dashmap", "parking_lot", "details"] }
typesize = { version = "0.1.6", optional = true, features = ["url", "time", "serde_json", "secrecy", "parking_lot", "nonmax", "extract_map_01"] }
# serde feature only allows for serialisation,
# Serenity workspace crates
command_attr = { version = "0.5.3", path = "./command_attr", optional = true }
serenity-voice-model = { version = "0.2.0", path = "./voice-model", optional = true }

# TODO (xacrimon): remove when https://github.com/GnomedDev/extract_map/pull/2 is merged and released
[patch.crates-io]
extract_map = { git = "https://github.com/xacrimon/extract_map.git", rev = "d7c2cd6" }

[dev-dependencies.http_crate]
version = "0.2.11"
version = "1.1.0"
package = "http"

[features]
Expand All @@ -76,49 +82,44 @@ default_native_tls = ["default_no_backend", "native_tls_backend"]

# Serenity requires a backend, this picks all default features without a backend.
default_no_backend = [
"builder",
"cache",
"chrono",
"client",
"framework",
"gateway",
"model",
"http",
"standard_framework",
"utils",
"transport_compression_zlib",
"transport_compression_zstd",
]

# Enables builder structs to configure Discord HTTP requests. Without this feature, you have to
# construct JSON manually at some places.
builder = []
builder = ["tokio/fs"]
# Enables the cache, which stores the data received from Discord gateway to provide access to
# complete guild data, channels, users and more without needing HTTP requests.
cache = ["fxhash", "dashmap", "parking_lot"]
cache = ["dashmap"]
# Enables collectors, a utility feature that lets you await interaction events in code with
# zero setup, without needing to setup an InteractionCreate event listener.
collector = ["gateway", "model"]
# Wraps the gateway and http functionality into a single interface
# TODO: should this require "gateway"?
client = ["http", "typemap_rev"]
collector = ["gateway"]
# Enables the Framework trait which is an abstraction for old-style text commands.
framework = ["client", "model", "utils"]
framework = ["gateway"]
# Enables gateway support, which allows bots to listen for Discord events.
gateway = ["flate2"]
gateway = ["model", "flate2"]
# Enables HTTP, which enables bots to execute actions on Discord.
http = ["mime_guess", "percent-encoding"]
http = ["dashmap", "mime_guess", "percent-encoding"]
# Enables wrapper methods around HTTP requests on model types.
# Requires "builder" to configure the requests and "http" to execute them.
# Note: the model type definitions themselves are always active, regardless of this feature.
# TODO: remove dependeny on utils feature
model = ["builder", "http", "utils"]
voice_model = ["serenity-voice-model"]
standard_framework = ["framework", "uwl", "levenshtein", "command_attr", "static_assertions", "parking_lot"]
# Enables zlib-stream transport compression of incoming gateway events.
transport_compression_zlib = ["flate2", "gateway"]
# Enables zstd-stream transport compression of incoming gateway events.
transport_compression_zstd = ["zstd-safe", "gateway"]
# Enables support for Discord API functionality that's not stable yet, as well as serenity APIs that
# are allowed to change even in semver non-breaking updates.
unstable_discord_api = []
unstable = []
# Enables some utility functions that can be useful for bot creators.
utils = []
voice = ["client", "model"]
voice = ["gateway"]
# Enables unstable tokio features to give explicit names to internally spawned tokio tasks
tokio_task_builder = ["tokio/tracing"]
interactions_endpoint = ["ed25519-dalek"]
Expand All @@ -127,33 +128,33 @@ chrono = ["dep:chrono", "typesize?/chrono"]

# This enables all parts of the serenity codebase
# (Note: all feature-gated APIs to be documented should have their features listed here!)
full = ["default", "collector", "unstable_discord_api", "voice", "voice_model", "interactions_endpoint"]

# Enables simd accelerated parsing.
simd_json = ["simd-json", "typesize?/simd_json"]
#
# Unstable functionality should be gated under the `unstable` feature.
full = ["default", "collector", "voice", "voice_model", "interactions_endpoint"]

# Enables temporary caching in functions that retrieve data via the HTTP API.
temp_cache = ["cache", "mini-moka", "typesize?/mini_moka"]

# Removed feature (https://github.com/serenity-rs/serenity/pull/2246)
absolute_ratelimits = []
typesize = ["dep:typesize", "dashmap/typesize", "small-fixed-array/typesize", "bool_to_bitflags/typesize"]

# Enables compile-time heavy instrument macros from tracing
tracing_instrument = ["tracing/attributes"]

# Backends to pick from:
# - Rustls Backends
rustls_backend = [
"reqwest/rustls-tls",
"tokio-tungstenite/rustls-tls-webpki-roots",
"bytes",
]

# - Native TLS Backends
native_tls_backend = [
"reqwest/native-tls",
"tokio-tungstenite/native-tls",
"bytes",
]


[package.metadata.docs.rs]
features = ["full"]
rustdoc-args = ["--cfg", "docsrs"]

Loading
Loading