Well, I'm gonna have to sleep on this @rustlang puzzle. I gotta figure out how to get Rust to reliably find a javascript file that should be included with its build. I think I'm gonna have to do a whole artifact generation/release process thing for this to work at all :s
-
Show this thread
-
How do people reliably point to, say, data files associated with an app in Rust?
8 replies 2 retweets 9 likesShow this thread -
In what context? You can use include_bytes to pack a file into the binary, or OUT_DIR environment variable at build time, but it sounds like you mean something else?
1 reply 0 retweets 4 likes -
Replying to @Lucretiel @rustlang
I'm tempted to use include_bytes if it's what I think it is. But it would be easier to just be able to refer to a file. OUT_DIR doesn't work for distributed binaries, though, does it?
3 replies 0 retweets 1 like -
There's been talk about making `fs::File::read` a const fn, which would allow it to do all the things include_bytes! does but behind a friendlier interface. To me this seems like the right long-term solution for these kinds of operations (albeit zero help right now
).1 reply 0 retweets 3 likes -
That's... bizzare. That seems to fly in the face of what a const function is supposed to be? Isn't one of the rules that you get the same result whether you run it at compile or runtime?
1 reply 0 retweets 2 likes -
I'm unsure about the specifics of the rules, but what you're saying sounds about right. Though I believe that constraint would still be upheld? If the same function is run from the same location it'd yield the same output during both compilation and runtime, would it not?
2 replies 0 retweets 0 likes -
No? If you compile your program and then edit ~/.config/app/config.yaml, you're going to see a different configuration
1 reply 0 retweets 0 likes
Ah, like that. I don't think that's a guarantee folks are going for. That seems closer to a "no side effects" interpretation of const fns, but include_bytes! and env! already interact with the environment so this wouldn't be much different.
-
-
Sure, but include_bytes and env aren't const fns.
0 replies 0 retweets 0 likesThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.