#Use of undeclared crate 'once_cell'

12 messages · Page 1 of 1 (latest)

karmic tapir
#

I'm currently trying to teach myself rust, and to start, I'm trying to pick apart some code as an example, but the code as is won't compile, complaining about not finding the crate once_cell. I'm confused because isn't once_cell part of base rust? Or am I missing something here?

valid tartan
#

Did you import it?
use std::cell::OnceCell;

random dune
#

once_cell used to be a third party crate but was recently added at std::cell::OnceCell

karmic tapir
#

I think I fixed it by adding it to my cargo.toml? But it's still confusing because the original example code didn't have it listed as a dependancy in its cargo.toml on github

weary folio
#

if it's once_cell::sync::OnceCell then you still need the library

weary folio
karmic tapir
#

It's an example for the iced gui library

#

I'm not able to log into discord on the pc I'm using, so give me a moment

weary folio
#
[dependencies]
iced.workspace = true
iced.features = ["debug"]

once_cell.workspace = true
#

that's a dep taken from the workspace's dep declarations

karmic tapir
#

Ahhh