Skip to content

error[E0277]: (dyn Any + 'static) cannot be sent between threads safely #299

Open
@lynn2910

Description

@lynn2910

Hi, I know this error is an issue that has been closed, but I don't understand HOW to access the "new_concurrent" method.

When I use this code:

  {
    let ftl_string = include_str!("../assets/languages/fr.ftl");
    let res = FluentResource::try_new(ftl_string.to_string()).expect("Failed to parse an FTL string.");
    
    let lang = langid!("fr-FR");
    let mut bundle = FluentBundle::new(vec![lang.clone()]);

    bundle.add_resource(res).expect("Failed to add FTL resources to the bundle.");

    langs.insert(lang, bundle);
  }

It doesn't give any error (in that part, I use threads so this part broke my whole project).
But, when I try to use the FluentBundle::new_concurrent method instead of FluentBundle::new, it says that this function doesn't exist, and I can't find anything about it in the documentation.

How can we access to this method ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions