Skip to content

v.embed_file #

Constants #

const (
	is_used = 1

fn find_index_entry_by_path #

fn find_index_entry_by_path(start voidptr, path string, algo string) &EmbedFileIndexEntry

find_index_entry_by_path is used internally by the V compiler:

fn register_decoder #

fn register_decoder(compression_type string, decoder Decoder)

struct EmbedFileData #

struct EmbedFileData {
	apath            string
	compression_type string
	compressed        &byte
	uncompressed      &byte
	free_compressed   bool
	free_uncompressed bool
	len  int
	path string
} EmbedFileData encapsulates functionality for the $embed_file() compile time call.

fn (EmbedFileData) str #

fn (ed EmbedFileData) str() string

fn (EmbedFileData) free #

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
	algo 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.