v.embed_file #

fn find_index_entry_by_path #

fn find_index_entry_by_path(start voidptr, path string) &EmbedFileIndexEntry

find_index_entry_by_path is used internally by the V compiler:

struct EmbedFileData #

struct EmbedFileData {
	path  string
	apath string
mut:
	compressed        &byte
	uncompressed      &byte
	free_compressed   bool
	free_uncompressed bool
pub:
	len int
}

https://github.com/vlang/rfcs/blob/master/embedding_resources.md EmbedFileData encapsulates functionality for the $embed_file() compile time call.

fn (EmbedFileData) str #

fn (ed EmbedFileData) str() string

fn (EmbedFileData) free #

unsafe
fn (mut ed EmbedFileData) free()

fn (EmbedFileData) to_string #

fn (original &EmbedFileData) to_string() string

fn (EmbedFileData) to_bytes #

fn (original &EmbedFileData) to_bytes() []byte

fn (EmbedFileData) data #

fn (mut ed EmbedFileData) data() &byte

struct EmbedFileIndexEntry #

struct EmbedFileIndexEntry {
	id   int
	path string
	data &byte
}

//////////////////////////////////////////////////////////////////////////// EmbedFileIndexEntry is used internally by the V compiler when you compile a program that uses $embed_file('file.bin') in -prod mode.
V will generate a static index of all embedded files, and will call the find_index_entry_by_path over the index and the relative paths of the embeds.
NB: these are public on purpose, to help -usecache.