Detailed description
Hey. I think having a function that would "include" data from files at compiletime (i.e. "embed" the file) would be really useful.
We don't have to have "include as code" (see Rust's include!()). The ones I care about are Rust's include_bytes!() and include_str!(). See the context below.
Opinions?
Context
Rust std's implementation:
https://doc.rust-lang.org/std/macro.include.html
https://doc.rust-lang.org/std/macro.include_bytes.html
https://doc.rust-lang.org/std/macro.include_str.html
Additional information
The usage would look something like this:
use "std/comptime"
static TEST_FILE_BYTES: []byte = comptime::IncludeBytes("test.txt")
static TEST_FILE_STR: str = comptime::IncludeStr("test.txt")
fn main() {
println(TEST_FILE_STR)
}
// Doing this should work too:
use "std/comptime"
fn main() {
testFileStr := comptime::IncludeStr("test.txt")
println(testFileStr)
}
Outputs the contents of test.txt converted to str, read on compiletime.
If there are no objections, I'd be happy to work on this.
Detailed description
Hey. I think having a function that would "include" data from files at compiletime (i.e. "embed" the file) would be really useful.
We don't have to have "include as code" (see Rust's
include!()). The ones I care about are Rust'sinclude_bytes!()andinclude_str!(). See the context below.Opinions?
Context
Rust std's implementation:
https://doc.rust-lang.org/std/macro.include.html
https://doc.rust-lang.org/std/macro.include_bytes.html
https://doc.rust-lang.org/std/macro.include_str.html
Additional information
The usage would look something like this:
Outputs the contents of
test.txtconverted tostr, read on compiletime.If there are no objections, I'd be happy to work on this.