aboutsummaryrefslogtreecommitdiff
path: root/src/framework
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-10-19 15:49:31 -0700
committerZeyla Hellyer <[email protected]>2017-10-19 15:49:31 -0700
commit585ac6e6ca792facf29063776c83262fa849161b (patch)
tree2173896c01526557bdd06b708ad61514241f266c /src/framework
parentDeprecate some text-only Channel methods (diff)
downloadserenity-585ac6e6ca792facf29063776c83262fa849161b.tar.xz
serenity-585ac6e6ca792facf29063776c83262fa849161b.zip
Fix shard connection
Fixes shard connections by removing the Default implementation for Shards. This was because when instantiating a Shard, `..Default::default()` syntax was used, which calls the `Default` implementation of the struct and moves the necessary values over to the overlying instantiation. When using `..Default::default()` syntax, all values in the Default implementation are instantiated, even ones that could be deemed unnecessary. For example, in the following sample code: ```rust struct Foo { x: bool, y: bool, } impl Default for Foo { fn default() -> Self { Self { x: true, y: true, } } } // ... let foo = Foo { x: false, ..Default::default() }; ``` `Foo::x` will still be instantiated in the Default implementation despite a value being set in the user's instantiation of Foo. This causes WebSocket client instantiation to be invalid in the Default instantiation, because the WebSocket instantiated has no base URL, causing an error to be returned. This commit resolves this issue by simply not having a Default implementation - due to the fact that a default implementation will never be valid and successful - and instead set all values in `Shard::new`. Notes: This issue surfaced with commit fcc4e2ce2e523248ed33c9f4853d3485cbc9b6e6 (PR #195). Closes #203.
Diffstat (limited to 'src/framework')
0 files changed, 0 insertions, 0 deletions