Похожие чаты

So it doesn't work even if I clone the string,

right?

5 ответов

4 просмотра

no? you just need to take a &'a str in set_path

Edoardo-La Greca Автор вопроса
Artem Starikov
no? you just need to take a &'a str in set_path

I use set_path() to set values in a global static mutable variable. Maybe I could create a &'static str variable inside main() containing the return value and pass it to set_path() ?

Edoardo-La Greca Автор вопроса
Artem Starikov
are you sure you need a mutable static?

Yep, it's used to store a path to a file that will be frequently accessed. More than one method need to know that path

Edoardo La Greca
Yep, it's used to store a path to a file that will...

I'd still refactor code without using mutable statics, but you can make a Box<str> and then leak it to get a &'static str

Похожие вопросы

Обсуждают сегодня

А как старый хаскел с новым стыковать ? потому как тут работает https://play.haskell.org/saved/C3xpMzcd, а вот тут https://stepik.org/lesson/7602/step/9?unit=1473 нет ошибка C...
Fedor
131
Guys what is ur real (no jokes) expectation of link price during this cycle?
Hobbyist
28
Hey, it seems like a solid project for the gaming industry. What are your initial thoughts?
Josh
26
Вопрос я правильно понимаю что в коде newtype ArrowMap k v = ArrowMap { getArrowMap :: k -> Maybe v } getArrowMap есть функция типа k -> Maybe v, если да, то не понимаю задач...
Fedor
64
hey everyone I'm not able to input come characters in my flatpak apps, they get ignored by the application. all other non-flatpak apps are fine with these characters. I search...
elo
13
Ребят, что лучше для реверса: гидра или ида?
En Vind Av Sorg
26
Works for everyone else, you think think SOL organically went from $8 to $220? Of course it didn’t, they pumped it. First to $20 with the narrative it would go back to $100, ...
Yankee Ruin X
8
What got more people talking about FTM? The week we were biggest gainer or this week with loads of amazing news but no positive price movement? The week we were biggest gain...
Yankee Ruin X
10
if (user?.choseType === 'oneDay') { await ctx.reply( 'Добро пожаловать в команду «Магнита»! Правда, на один день ☺️ ', ); await ctx.s...
Kokni
1
Делаю велосипед логгер. К сообщению хочу прикрутить некоторую информацию, типа, кем отправлено, какой уровень, и всякое такое. И тут подумалось мне, почему бы не хранить весь...
Serjone
24
Карта сайта