cloudflare / cloudflare/workers-rs

[BUG] Router run() function takes self, not &self

Open
#279 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
3.7k
Forks
429
Avg merge
20h 28m
Merged PRs (30d)
7

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### What version of `workers-rs` are you using?

0.0.12

### Describe the bug

I wanted to be able to reuse a Router for multiple fetches, as our router is complicated and I'd like to build it only once rather than every time I handle a request. I cannot do this because the run() method takes self rather than &self or &mut self, and thus the router is moved out of my ownership and dropped when run() finishes. I'm not sure if this is intentional for reasons I have missed, or merely a typo in the implementation.

### Steps To Reproduce

N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.