Skip to content

Add Rc to Arc feature in async and multithread context #620

@azoyan

Description

@azoyan

Is it possible to add feature to replace Rc in inner structures to Arc to use in async context?

pub struct RateLimitBodyJsonPath {
    pub jsonpath: Vec<RsonpathEngine>
}
error[E0277]: `Rc<StringPattern>` cannot be shared between threads safely
   --> core/src/rule/mod.rs:339:21
    |
339 | /                     tokio::spawn(async move {
340 | |                         let mut guard = RULES.write().await;
341 | |                         guard.remove(tenant_clone.as_str());
342 | |                     });
    | |______________________^ `Rc<StringPattern>` cannot be shared between threads safely
    |
    = help: within `[(Rc<StringPattern>, rsonpath::automaton::State); 2]`, the trait `Sync` is not implemented for `Rc<StringPattern>`, which is required by `{async block@core/src/rule/mod.rs:339:34: 339:44}: Send`
    = note: required because it appears within the type `(Rc<StringPattern>, rsonpath::automaton::State)`
    = note: required because it appears within the type `[(Rc<StringPattern>, rsonpath::automaton::State); 2]`
    = note: required for `smallvec::SmallVecData<[(Rc<StringPattern>, rsonpath::automaton::State); 2]>` to implement `Sync`

Metadata

Metadata

Assignees

Labels

area: libraryImprovements to the library API qualitytype: featureNew feature or request

Type

No type

Projects

Status

Merged

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions