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

Encapsulate Message Cache in it's own type #3065

Draft
wants to merge 163 commits into
base: next
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
163 commits
Select commit Hold shift + click to select a range
3b4713e
Remove temporary `Vec` usage in the `http` module (#2624, #2646)
GnomedDev Dec 3, 2023
401b369
Remove deprecated items (#2645)
GnomedDev Dec 3, 2023
4fa51ea
Remove more deprecated items (#2651)
GnomedDev Dec 8, 2023
cc1bd45
Remove `*_arc` methods (#2654)
GnomedDev Dec 8, 2023
3f224bb
Clean up `ShardManager`/`ShardQueuer`/`ShardRunner` (#2653)
GnomedDev Dec 9, 2023
0c1aea4
Put `Message::thread` behind a `Box` (#2658)
GnomedDev Dec 9, 2023
5e84751
Replace `Vec` and `String` with `FixedArray` and `FixedString` for al…
GnomedDev Dec 10, 2023
1a961ac
Fix truncation when using `FixedString<u8>` where multibyte character…
GnomedDev Dec 14, 2023
0700733
Encode timestamps in RFC3339 (#2665)
Kerollmops Dec 22, 2023
3305c46
Switch to `i64` in methods associated with `CreateCommandOption` (#2668)
ARandomDev99 Dec 22, 2023
4ee1f9e
Get rid of the duplicate users cache (#2662)
GnomedDev Dec 28, 2023
eb85287
Change `Embed::fields` to use `FixedArray` (#2674)
GnomedDev Dec 28, 2023
6b74b4b
Use `FixedArray` and `FixedString` in model enums (#2675)
GnomedDev Dec 28, 2023
55516a6
Bitpack boolean fields using fancy proc macro (#2673)
GnomedDev Dec 31, 2023
a9526a1
Use `nonmax::NonMax*` types in `Option`s wherever possible (#2681)
GnomedDev Jan 2, 2024
9111cf7
Remove unused warning `#[allow(...)]`s (#2682)
GnomedDev Jan 2, 2024
508671d
Get rid of `unsafe` (#2686)
GnomedDev Jan 3, 2024
dae0876
Swap Git dependencies for crates.io published versions (#2685)
GnomedDev Jan 3, 2024
9d3a2ff
Swap Id from `NonZero` to `NonMax` (#2689)
GnomedDev Jan 5, 2024
7b99731
Rewrite builders to take `Cow`s (#2688)
GnomedDev Jan 6, 2024
4750dc5
Store `Request::params` as a slice instead of owning `ArrayVec` (#2694)
GnomedDev Jan 7, 2024
58fc709
Revert `Request::params` back to `Option` (#2695)
mkrasnitski Jan 7, 2024
e6b3342
Remove unnecessary `Vec` in `WsClient` (#2705)
GnomedDev Jan 10, 2024
60847c6
Feature gate `#[instrument]` macros (#2707)
GnomedDev Jan 10, 2024
b1cf043
Remove `impl Into<Option>` (#2701)
GnomedDev Jan 10, 2024
0da0908
Get rid of `IntoIterator` generics wherever they are inefficent (#2698)
GnomedDev Jan 10, 2024
6bb3061
Clean up `Ratelimiter` (#2687)
GnomedDev Jan 10, 2024
9159c1e
Handle overflow checks in central locations (#2697)
GnomedDev Jan 10, 2024
41a632f
Shrink size and clean up `Error` (#2700)
GnomedDev Jan 10, 2024
4f4dbd9
Remove manual `#[inline]` attributes (#2702)
GnomedDev Jan 10, 2024
5bf83c9
Remove `Into<*Id>` and `AsRef<str>` (#2704)
GnomedDev Jan 11, 2024
62f46e9
Remove `Event::Unknown` variant (#2708)
mkrasnitski Jan 12, 2024
ca358bc
Use `NonMax` to signal builder range constraints (#2703)
GnomedDev Jan 14, 2024
41bd643
Stop using `Value` in error parsing (#2710)
GnomedDev Jan 14, 2024
7496003
Fix new clippy lints (#2713)
GnomedDev Jan 14, 2024
2f17cb5
Update to `small-fixed-array` v0.2 (#2711)
GnomedDev Jan 14, 2024
d6d5237
Fix `@everyone` role deserialisation (#2716)
GnomedDev Jan 16, 2024
0c7eabe
Fix `GuildChannel` deserialisation with `user_limit` (#2715)
GnomedDev Jan 16, 2024
44f127d
Fix maximum description length to the correct size (#2718)
Milo123459 Jan 16, 2024
5af8e32
Remove dashboard example (#2714)
GnomedDev Jan 16, 2024
09e8a3a
Fix compilation from rebase
arqunis Jan 16, 2024
26251dd
Remove deprecated `absolute_ratelimits` feature (#2719)
GnomedDev Jan 16, 2024
9177366
Implement `max_concurrency` support when starting shards (#2661)
mkrasnitski Jan 16, 2024
9314127
Remove typemap without making everything generic (#2720)
GnomedDev Jan 16, 2024
b8d0bb6
Provide `Arc<Data>` instead of `&Data` (#2722)
GnomedDev Jan 17, 2024
cf4a97f
Add `Client::try_data` to fallibly fetch the data type (#2723)
GnomedDev Jan 18, 2024
66876c0
Fix voice manager initialisation (#2727)
GnomedDev Jan 21, 2024
aceaea4
Remove some pedantic lints from the whitelist (#2728)
mkrasnitski Jan 21, 2024
5fbb3cb
Reduce unknown events to debug level, again (#2730)
GnomedDev Jan 21, 2024
461c16a
Fix compilation from rebase
arqunis Jan 22, 2024
8e73873
Fix testing example
mkrasnitski Jan 22, 2024
5b7290f
Remove `PartialEq` implementations from all builders (#2734)
mkrasnitski Jan 22, 2024
df68dde
Remove various instances of `impl AsRef<T>` (#2736)
GnomedDev Jan 24, 2024
24a1549
Remove `simd-json` support (#2735)
GnomedDev Jan 24, 2024
eadc5db
Fix massive code size of `client::dispatch` (#2739)
GnomedDev Jan 25, 2024
b5dca39
Fix RoleTags deserialisation after removal of simd-json (#2742)
GnomedDev Jan 26, 2024
f67eb85
Avoid cloning FullEvent in dispatch code (#2740)
GnomedDev Jan 27, 2024
f39aab7
Remove the builder trait and only take required arguments (#2741)
GnomedDev Jan 27, 2024
102085f
Use Serializer::collect_seq in serialize impls (#2744)
GnomedDev Jan 28, 2024
ee405e9
Convert enum number into wrapper struct to save type sizes (#2746)
GnomedDev Jan 29, 2024
09b031f
Use Arc<str> to store the token (#2745)
GnomedDev Jan 29, 2024
80b4585
Remove standard framework (#2731)
GnomedDev Jan 29, 2024
6c20385
Re-add Secret to bot token (#2748)
GnomedDev Jan 29, 2024
050bbec
Take Arc<Http> in ClientBuilder::new_with_http (#2749)
GnomedDev Feb 3, 2024
0a56dce
Remove duplicate content_safe implementation (#2759)
GnomedDev Feb 9, 2024
71db8ff
Simplify the message cache (#2757)
GnomedDev Feb 9, 2024
b08bd2f
Upgrade to small-fixed-array 0.4 (#2755)
GnomedDev Feb 9, 2024
5a62b80
Avoid HashMap in ShardQueue (#2750)
GnomedDev Feb 11, 2024
5a97236
Switch to a generic type argument for `ClientBuilder::data` (#2765)
vicky5124 Feb 11, 2024
3547392
Fix `VoiceServerUpdate::guild_id` being wrapped in `Option` (#2766)
GnomedDev Feb 13, 2024
6f7c26d
Improve MessageBuilder to fit with other builders (#2767)
GnomedDev Feb 15, 2024
0970f81
Fill message cache with ChannelId::messages and ChannelId::pins (#2768)
GnomedDev Feb 15, 2024
cbf4745
Defer deserialisation of Dispatch to handle errors (#2764)
GnomedDev Feb 16, 2024
d532a9f
Remove duplicate `external_emojis` accessor (#2770)
wackbyte Feb 16, 2024
82a67f9
Remove `CreateAttachment::id` field (#2771)
mkrasnitski Feb 17, 2024
a7a9576
Fix compilation from rebase
arqunis Mar 1, 2024
a53165c
Fix remaining clippy warnings
GnomedDev Mar 1, 2024
40d515e
Format unformatted code from rebase
arqunis Mar 1, 2024
2aca6ba
Remove rebase artifacts in README
arqunis Mar 1, 2024
31ad8db
Synchronise README example from the `current` branch
arqunis Mar 1, 2024
39ac63e
Minor adjustments
mkrasnitski Mar 1, 2024
087e08b
Apply Strum derives for FullEvent and Event (#2788)
cheesycod Mar 10, 2024
3360af9
Remove `Channel::name` (#2787)
GnomedDev Mar 10, 2024
da71a57
Use join_to_string throughout serenity (#2785)
GnomedDev Mar 10, 2024
981cc06
Use ToArrayString for int -> str (#2786)
GnomedDev Mar 10, 2024
1cbe747
Rename `unstable_discord_api` to `unstable` and disable it by default…
cheesycod Mar 10, 2024
c48de71
Remove deprecated Channel::is_nsfw methods (#2792)
GnomedDev Mar 11, 2024
7c7f5b3
Replace manual Hash/Eq implementation on User/Role (#2793)
GnomedDev Mar 12, 2024
6c59cfc
Remove useless method wrappers (#2795)
GnomedDev Mar 13, 2024
053c3b7
Fix unused variable warning from rebase
GnomedDev Mar 13, 2024
e60abd7
Remove deprecated mapped refs and Cache::channels (#2796)
GnomedDev Mar 13, 2024
e283d66
Use ExtractMap instead of HashMap when possible (#2797)
GnomedDev Mar 17, 2024
2b5490c
Remove examples and inaccurate docs from HTTP (#2805)
GnomedDev Mar 17, 2024
0a30233
Use NonMax in HTTP function signatures (#2803)
GnomedDev Mar 17, 2024
0cae384
Fix infinite loop in event deserialisation
arqunis Mar 19, 2024
38eb300
Make Guild::shard_id follow additive features (#2813)
GnomedDev Mar 21, 2024
85fa8e1
Remove deprecated `Member` and `Guild` methods (#2817)
GnomedDev Mar 26, 2024
f849de1
Replace `CacheHttp` with `&Http` in more methods (#2818)
GnomedDev Mar 28, 2024
893c289
Remove `serde_json::Value` from `Http` (#2806)
GnomedDev Mar 28, 2024
a28b331
Add audit log reasons to remaining model methods (#2821)
GnomedDev Mar 29, 2024
8bb805d
Remove even more impl CacheHttp (#2822)
GnomedDev Mar 29, 2024
4804f33
Remove `fs` feature for `tokio` by default (#2824)
UserIsntAvailable Mar 30, 2024
5cbd909
Update `reqwest` to v0.12 (#2826)
GnomedDev Apr 1, 2024
5049338
Only include `cache::Settings::time_to_live` if temp cache is enabled…
GnomedDev Apr 3, 2024
a7a7ba7
Add resume_gateway_url support (#2832)
GnomedDev Apr 6, 2024
1c66822
Correct documentation for `UserId::to_user` (#2809)
jamesbt365 Apr 9, 2024
ec2f6b0
Use CreateAttachment for EditGuild::banner (#2844)
NotNorom Apr 20, 2024
94d56c3
Fix AuditLogEntry::user_id (#2846)
GnomedDev Apr 20, 2024
cec3ca5
Restore match arm for `Error::Gateway` variant (#2847)
mkrasnitski Apr 22, 2024
ef23ef3
Remove multiple event handler support (#2849)
GnomedDev Apr 24, 2024
9b12635
Use RwLock for active collectors collection (#2851)
TheCataliasTNT2k Apr 26, 2024
0f10580
Provide old presence data from the cache on presence update (#2852)
jamesbt365 Apr 28, 2024
9b7a1e5
Allow filtering events before they are dispatched (#2853)
TheCataliasTNT2k Apr 28, 2024
ae5bb4c
Remove permission checks (#2855)
jamesbt365 May 1, 2024
a4a4daf
Implement ToArrayString for Mention (#2857)
GnomedDev May 7, 2024
45cad51
Add PartialGuild::greater_member_hierarchy + member_highest_role (#2856)
cheesycod May 8, 2024
8bf2730
Remove recently deprecated items
GnomedDev May 23, 2024
86beab0
Update bool_to_bitflags to fix compilation without unstable
GnomedDev May 14, 2024
bbaa2ce
Remove RUSTFLAGS from .cargo/config.toml (#2875)
jamesbt365 May 23, 2024
1632e8c
Remove deprecated link_ensured method (#2898)
GnomedDev Jun 10, 2024
13b8d5f
Add GuildId param to ChannelId::to_channel (#2895)
GnomedDev Jun 16, 2024
0ecc02d
Clean up `Message::reply` (#2897)
GnomedDev Jun 16, 2024
bd26f55
Use `ArrayString` in more places via `aformat!` (#2902)
GnomedDev Jun 22, 2024
fbbc763
Bump MSRV to Rust 1.79 (#2916)
mkrasnitski Jul 11, 2024
645a338
Remove deprecated `CreateInteractionResponse::PremiumRequired` varian…
mkrasnitski Aug 5, 2024
e5dc732
Add `OAuth2Token`, `OAuth2TokenRevocation`, and `OAuth2AuthorizationC…
valentinegb Aug 8, 2024
bbd00af
Allow setting both normal and raw event handlers (#2933)
tazz4843 Aug 16, 2024
1d09237
Merge `client` feature/module into `gateway` (#2947)
mkrasnitski Aug 22, 2024
f5002e5
Remove methods on `ClientBulder` that don't serve a purpose (#2953)
mkrasnitski Aug 23, 2024
b906381
Fix and make `edit_role_position` plural (#2954)
mkrasnitski Aug 23, 2024
5377e8e
Fix model functions using `SerializeIter` (#2955)
GnomedDev Aug 26, 2024
03c59f8
Remove `InternalEventHandler` (#2952)
mkrasnitski Aug 26, 2024
9023e72
Truncate cache if `max_messages` is set to a lower value at runtime (…
ivinjabraham Aug 30, 2024
379dfcf
Add enum for JSON error codes in `DiscordJsonError` (#2964)
ivinjabraham Sep 1, 2024
f429950
Update to DashMap 6 (#2961)
GnomedDev Sep 9, 2024
0efd4d9
Fix unused warnings when compiling without certain features (#2970)
mkrasnitski Sep 13, 2024
6f99a5d
Fix public doctests that are marked `ignore` (#2976)
mkrasnitski Sep 20, 2024
820a54e
Allow embeds to be optional in followup messages (#2968)
TapGhoul Oct 7, 2024
ecacdae
Swap `Vec<T>` for `Cow<[T]>` in `CreateActionRow::Buttons` (#2985)
GnomedDev Oct 7, 2024
7b0bd9a
Remove more `json!` usage (#2986)
GnomedDev Oct 7, 2024
10bbfb5
Replace outdated secrecy library with own impl (#2997)
GnomedDev Oct 21, 2024
810284f
Check for lints which change public API (#2999)
GnomedDev Oct 21, 2024
9541e26
Stop using serde_json::Value in AutocompleteChoice::value (#3000)
GnomedDev Oct 21, 2024
2ad8eb5
feat: Make FullEvent serializable (#3010)
cheesycod Oct 31, 2024
d65dfca
Add `Context::data_ref` (#3017)
GnomedDev Nov 6, 2024
652c4c9
Delete passthrough methods (#3023)
GnomedDev Nov 11, 2024
06619d4
Swap CreateAttachment::data to Bytes (#3016)
GnomedDev Nov 11, 2024
1d9b625
Add `EditCommand` builder (#3028)
mkrasnitski Nov 12, 2024
a6a7e6a
Remove deprecated GuildChannel::permissions_for_user (#3033)
GnomedDev Nov 13, 2024
5b84fd1
Improve some docs (#3027)
mkrasnitski Nov 13, 2024
e9238dd
Add config for the shard start wait time (#3031)
cheesycod Nov 13, 2024
efb5820
Remove Option around Interaction::app_permissions (#3034)
GnomedDev Nov 13, 2024
6c67796
Remove deprecated permissions methods (#3042)
GnomedDev Nov 16, 2024
4a96fe1
Update `tokio-tungstenite` dependency to 0.24 (#3048)
DPlayer234 Nov 18, 2024
2e12663
Perform some misc TODO cleanups (#3050)
GnomedDev Nov 18, 2024
b20151f
Transport compression support (#3036)
fgardt Nov 18, 2024
099315f
Get rid of redundant status argument in Http::wind (#3049)
GnomedDev Nov 18, 2024
1a0a809
Perform some minor cleanups (#3051)
mkrasnitski Nov 19, 2024
2369544
Improve token semantics and clean up gateway feature gates (#3052)
mkrasnitski Nov 22, 2024
46096e8
Add Token to serenity::all (#3054)
GnomedDev Nov 22, 2024
5e275eb
Use correct token prefix after parsing
arqunis Nov 23, 2024
281595a
Change MessageUpdateEvent to just contain a full Message
GnomedDev Nov 25, 2024
fc40056
Encapsulate Message Cache in it's own type
GnomedDev Nov 25, 2024
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
53 changes: 20 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,6 @@ jobs:
- no cache
- no gateway
- unstable Discord API features
- simd-json

include:
- name: beta
Expand All @@ -38,21 +37,19 @@ 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

steps:
Expand Down Expand Up @@ -131,9 +128,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 +204,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 +234,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
85 changes: 41 additions & 44 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ readme = "README.md"
repository = "https://github.com/serenity-rs/serenity.git"
version = "0.12.4"
edition = "2021"
rust-version = "1.74"
rust-version = "1.82.0"
include = ["src/**/*", "LICENSE.md", "README.md", "CHANGELOG.md", "build.rs"]

[workspace]
Expand All @@ -22,41 +22,43 @@ 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"] }
dep_time = { version = "0.3.36", package = "time", 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"
# 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.24.0", 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 }

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

[features]
Expand All @@ -66,49 +68,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 = ["fxhash", "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 @@ -117,33 +114,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